UpSz     (c) 2011 MailRank, Inc.BSD3XBryan O'Sullivan <bos@serpentine.com>, Bas van Dijk <v.dijk.bas@gmail.com> experimentalportableNone +3HM 3Action for creating a new entry to add to the pool.5Action for destroying an entry that is now done with.\The number of stripes (distinct sub-pools) to maintain. The smallest acceptable value is 1.iAmount of time for which an unused resource is kept alive. The smallest acceptable value is 0.5 seconds.yThe elapsed time before closing may be a little longer than requested, as the reaper thread wakes at 1-second intervals.YMaximum 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.4empty value used to attach a finalizer to (internal)A single striped pool.-Count of open entries (both idle and in use). Idle entries.4empty value used to attach a finalizer to (internal)A single resource pool entry.Time of last return.Create a striped resource pool.Although the garbage collector will destroy all idle resources when the pool is garbage collected it's recommended to manually  X 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 IO computation, but first labels the thread with the given label (using ).The implementation makes sure that asynchronous exceptions are 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 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 C, perform an action with it, and return it to the pool afterwards.FIf the pool has an idle resource available, it is used immediately.nOtherwise, if the maximum number of resources has not yet been reached, a new resource is created and used.pIf the maximum number of resources has been reached, this function blocks until a resource becomes available.hIf 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 destroy a pooled resource, as doing so will almost certainly cause 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 t. 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  LocalPool7 it came from so that it may either be destroyed (via   ) or returned to the pool (via  ). Similar to K, 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). 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  WDestroy a resource. Note that this will ignore any exceptions in the destroy function. Return a resource to the given . uDestroy all resources in all stripes in the pool. Note that this will ignore any exceptions in the destroy function.This function is useful when you detect that all resources in the pool are broken. For example after a database has been restarted all connections opened before the restart will be broken. In that case it's better to close those connections so that W won't take a broken connection from the pool but will open a new connection instead.Another use-case for this function is that when you know you are done with the pool you can destroy all idle resources immediately 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.\The number of stripes (distinct sub-pools) to maintain. The smallest acceptable value is 1.hAmount 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.ZMaximum 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.2 Data.PoolPool numStripesidleTime maxResources LocalPool createPool withResource takeResourcetryWithResourcetryTakeResourcedestroyResource putResourcedestroyAllResourcescreatedestroy localPoolsfininUseentrieslfinEntrylastUseforkIOLabeledWithUnmaskbase GHC.Conc.SyncforkIOWithUnmask labelThreadThreadIdreaperpurgeLocalPool Data.MaybeNothingJust getLocalPoolentry modifyTVar_modError $fShowPool