úÎV8TB     portable experimentalXBryan O'Sullivan <bos@serpentine.com>, Bas van Dijk <v.dijk.bas@gmail.com>None 4Action for creating a new entry to add to the pool. 6Action for destroying an entry that is now done with. 8The number of stripes (distinct sub-pools) to maintain. % The smallest acceptable value is 1. ;Amount of time for which an unused resource is kept alive. / The smallest acceptable value is 0.5 seconds. <The elapsed time before closing may be a little longer than > requested, as the reaper thread wakes at 1-second intervals. 9Maximum number of resources to maintain per stripe. The ! smallest acceptable value is 1. @Requests for resources will block if this limit is reached on a : single stripe, even if other stripes have idle resources  available. Per-capability resource pools. 5empty value used to attach a finalizer to (internal) A single striped pool. .Count of open entries (both idle and in use). Idle entries. 5empty value used to attach a finalizer to (internal) A single resource pool entry. Time of last return.  Create a striped resource pool. DAlthough the garbage collector will destroy all idle resources when ! the pool is garbage collected it's recommended to manually    when you'"re done with the pool so that the - resources are freed up as soon as possible. Sparks off a new thread using  to run the given B IO computation, but first labels the thread with the given label  (using ). ?The implementation makes sure that asynchronous exceptions are B masked until the given computation is executed. This ensures the ? thread will always be labeled which guarantees you can always & easily find it in the GHC event log. Like ,, the given computation is given a function B to unmask asynchronous exceptions. See the documentation of that & function for the motivation of this.  Returns the  of the newly created thread. >Periodically go through all pools, closing any resources that # have been left idle for too long. (Destroy all idle resources of the given  and remove them from  the pool. #Temporarily take a resource from a , perform an action with + it, and return it to the pool afterwards. 8 If the pool has an idle resource available, it is used  immediately. @ Otherwise, if the maximum number of resources has not yet been 0 reached, a new resource is created and used. ; If the maximum number of resources has been reached, this 7 function blocks until a resource becomes available. ?If the action throws an exception of any type, the resource is * destroyed, and not returned to the pool. ?It probably goes without saying that you should never manually D destroy a pooled resource, as doing so will almost certainly cause C a subsequent user (who expects the resource to be valid) to throw  an exception. =Take a resource from the pool, following the same results as  :. Note that this function should be used with caution, as ; improper exception handling can lead to leaked resources. .This function returns both a resource and the  LocalPool it came from so & that it may either be destroyed (via  ) or returned to the  pool (via  ).  Similar to 3, but only performs the action if a resource could  be taken from the pool without blocking . Otherwise,   returns immediately with  (ie. the action function is not called). O Conversely, if a resource can be borrowed from the pool without blocking, the  action is performed and it'#s result is returned, wrapped in a . A non-blocking version of . The   function  returns immediately, with  if the pool is exhausted, or  (a,   a)= if a resource could be borrowed from the pool successfully. Get a (Thread-) &Internal, just to not repeat code for  and   EDestroy a resource. Note that this will ignore any exceptions in the  destroy function. Return a resource to the given . ADestroy all resources in all stripes in the pool. Note that this 5 will ignore any exceptions in the destroy function. BThis function is useful when you detect that all resources in the B pool are broken. For example after a database has been restarted C all connections opened before the restart will be broken. In that  case it',s better to close those connections so that   won'=t take a broken connection from the pool but will open a new  connection instead. AAnother use-case for this function is that when you know you are C done with the pool you can destroy all idle resources immediately C instead of waiting on the garbage collector to destroy them, thus $ freeing up those resources sooner. !  !"$Action that creates a new resource. +Action that destroys an existing resource. 8The number of stripes (distinct sub-pools) to maintain. % The smallest acceptable value is 1. :Amount of time for which an unused resource is kept open. / The smallest acceptable value is 0.5 seconds. >The elapsed time before destroying a resource may be a little ? longer than requested, as the reaper thread wakes at 1-second  intervals. :Maximum number of resources to keep open per stripe. The ! smallest acceptable value is 1. @Requests for resources will block if this limit is reached on a : single stripe, even if other stripes have idle resources  available.   #$%     !"  #$%&      ! "#$%&'(resource-pool-0.2.3.1 Data.PoolPool numStripesidleTime maxResources LocalPool createPool withResource takeResourcetryWithResourcetryTakeResourcedestroyResource putResourcedestroyAllResourcescreatedestroy localPoolsfininUseentrieslfinEntrylastUseforkIOLabeledWithUnmaskbase GHC.Conc.SyncforkIOWithUnmask labelThreadThreadIdreaperpurgeLocalPool Data.MaybeNothingJust getLocalPoolentry modifyTVar_modError $fShowPool