!ca      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`(c) Naoto Shimazaki 2018-2020MIT (see the file LICENSE)https://github.com/nshimaza experimentalSafelmthread-supervisor=Queue with delay before elements become available to dequeue.thread-supervisor Create a new  with given delay.thread-supervisorEnqueue a value to a .thread-supervisorDequeue a value from a .thread-supervisor(Delay of the queue in number of element.thread-supervisorCreated queue.thread-supervisorvalue to be queued.thread-supervisor#queue where the value to be queued.thread-supervisor$new queue where the value is pushed.thread-supervisor! from which a value to be pulled.thread-supervisorFNothing if there is no available element. Returns pulled value and ( with the value removed wrapped in Just.(c) Naoto Shimazaki 2018-2020MIT (see the file LICENSE)https://github.com/nshimaza experimentalNonelmMthread-supervisorRestart strategy of supervisorthread-supervisorRestart only exited thread.thread-supervisorGRestart all threads supervised by the same supervisor of exited thread. thread-supervisor8Type synonym for read-end of supervisor's message queue. thread-supervisor9Type synonym for write-end of supervisor's message queue. thread-supervisor 2 defines all message types supervisor can receive. thread-supervisor)Notification of child thread termination. thread-supervisor)Command to start a new supervised thread.thread-supervisor keeps data used for detecting intense restart. It keeps maxR (maximum restart intensity), maxT (period of majoring restart intensity) and history of restart with system timestamp in a form.thread-supervisorLength of time window in b) where the number of restarts is counted.thread-supervisorRestart timestamp history.thread-supervisor_ defines condition how supervisor determines intensive restart is happening. If more than % time of restart is triggered within , supervisor decides intensive restart is happening and it terminates itself. Default intensity (maximum number of acceptable restart) is 1. Default period is 5 seconds.thread-supervisor;Maximum number of restart accepted within the period below.thread-supervisorLength of time window in b) where the number of restarts is counted.thread-supervisor= is mutable variable which holds pool of living threads and > of each thread. ThreadMap is used inside of supervisor only.thread-supervisor is representation of IO action which can be supervised by supervisor. Supervisor can run the IO action with separate thread, watch its termination and restart it based on restart type.thread-supervisorY defines when terminated child thread triggers restart operation by its supervisor.  only defines when it triggers restart operation. It does not directly means if the thread will be or will not be restarted. It is determined by restart strategy of supervisor. For example, a static @ child never triggers restart on its termination but static $ child will be restarted if another  or Z thread with common supervisor triggered restart operation and the supervisor has  strategy.thread-supervisor thread always triggers restart.thread-supervisor@ thread triggers restart only if it was terminated by exception.thread-supervisor thread never triggers restart.thread-supervisorr is type synonym of function with callback on termination installed. Its type signature fits to argument for c.thread-supervisorX is user supplied callback function which is called when monitored thread is terminated.thread-supervisor( indicates reason of thread termination. thread-supervisorThread was normally finished.!thread-supervisorA synchronous exception was thrown and it was not caught. This indicates some unhandled error happened inside of the thread handler."thread-supervisorcAn asynchronous exception was thrown. This also happen when the thread was killed by supervisor.#thread-supervisorQTimeout of call method for server behavior in microseconds. Default is 5 second.%thread-supervisor9Type synonym of callback function to obtain return value.&thread-supervisorActor representation.(thread-supervisorWrite end of message queue of &)thread-supervisorIO action to execute &*thread-supervisorCType synonym of user supplied message handler working inside actor.+thread-supervisor Write end of / exposed to outside of actor.-thread-supervisorMaximum length of /./thread-supervisorMessage queue abstraction.1thread-supervisor6Concurrent queue receiving message from other threads.2thread-supervisor)Number of elements currently held by the /.3thread-supervisorSaved massage by ;w. It keeps messages not selected by receiveSelect in reversed order. Latest message is kept at head of the list.4thread-supervisorMaximum length of the /.5thread-supervisorCreate a new empty /.6thread-supervisorSend a message to given +!. Block while the queue is full.7thread-supervisorGSend a message to sending actor itself. Block while the queue is full.8thread-supervisorTry to send a message to given +0. Return Nothing if the queue is already full.9thread-supervisor\Try to end a message to sending actor itself. Return Nothing if the queue is already full.:thread-supervisor)Number of elements currently held by the +.;thread-supervisor%Perform selective receive from given /.; searches given queue for first interesting message predicated by user supplied function. It applies the predicate to the queue, returns the first element that satisfy the predicate, and remove the element from the Inbox.aIt blocks until interesting message arrived if no interesting message was found in the queue.Caution,Use this function with care. It does NOT discard any message unsatisfying predicate. It keeps them in the queue for future receive and the function itself blocks until interesting message arrived. That causes your queue filled up by non-interesting messages. There is no escape hatch.Consider using < instead.Caveat7Current implementation has performance caveat. It has O(n)& performance characteristic where n is number of messages existing before your interested message appears. It is because this function performs liner scan from the top of the queue every time it is called. It doesn't cache pair of predicates and results you have given before.,Use this function in limited situation only.<thread-supervisor,Try to perform selective receive from given /.< searches given queue for first interesting message predicated by user supplied function. It applies the predicate to the queue, returns the first element that satisfy the predicate, and remove the element from the Inbox.HIt return Nothing if there is no interesting message found in the queue.Caveat7Current implementation has performance caveat. It has O(n)& performance characteristic where n is number of messages existing before your interested message appears. It is because this function performs liner scan from the top of the queue every time it is called. It doesn't cache pair of predicates and results you have given before.,Use this function in limited situation only.=thread-supervisor.Find oldest message satisfying predicate from  saveStackE, return the message, and remove it from the saveStack. Returns d' if there is no satisfying message.>thread-supervisorUpdate / with new  saveStack( which already have one message removed.?thread-supervisorReceive first message in /!. Block until message available.@thread-supervisor Try to receive first message in /8. It returns Nothing if there is no message available.Athread-supervisorCreate a new actor.5Users have to supply a message handler function with *" type. ActorHandler accepts a / and returns anything.A creates a new /, apply user supplied message handler to the queue, returns reference to write-end of the queue and IO action of the actor. Because A only returns + , caller of A` can only send messages to created actor. Caller cannot receive message from the queue./, or read-end of the queue, is passed to user supplied message handler so the handler can receive message to the actor. If the handler need to send a message to itself, wrap the message queue by + constructor then use 6 over created +. Here is an example. send (ActorQ yourInbox) messageBthread-supervisor,Create a new actor with bounded inbox queue.Cthread-supervisor"Create a new finite state machine.+The state machine waits for new message at /S then callback user supplied message handler. The message handler must return e with new state or f with final result. When eB is returned, the state machine waits for next message. When fF is returned, the state machine terminates and returns the result.Cx returns an IO action wrapping the state machine described above. The returned IO action can be executed within an g or bare thread.Created IO action is designed to run in separate thread from main thread. If you try to run the IO action at main thread without having producer of the message queue you gave, the state machine will dead lock.Dthread-supervisorDcreate an unbound actor of newStateMachine. Short-cut of following. 6newActor $ newStateMachine initialState messageHandlerEthread-supervisor)Send an asynchronous request to a server.Fthread-supervisorSSend an synchronous request to a server and waits for a return value until timeout.Gthread-supervisorMake an asynchronous call to a server and give result in CPS style. The return value is delivered to given callback function. It also can fail by timeout. Calling thread can * for a return value from the callback.Use this function with care because there is no guaranteed cancellation of background worker thread other than timeout. Giving infinite timeout (zero) to the #Q argument may cause the background thread left to run, possibly indefinitely.Hthread-supervisor4Send an request to a server but ignore return value.Ithread-supervisorInstall ' callback function to simple IO action.Jthread-supervisorConvert simple IO action to  without installing .Kthread-supervisorInstall another  callback function to .Lthread-supervisor Create a  from .Mthread-supervisor Create a  from plain IO action.Nthread-supervisorAdd a  function to existing .Othread-supervisorCreate an empty Pthread-supervisor Start new thread based on given  , register the thread to given  then returns h of the thread.Qthread-supervisor-Create new IntenseRestartDetector with given  parameters.Rthread-supervisorfDetermine if the last restart results intensive restart. It pushes the last restart timestamp to the  of restart history held inside of the IntenseRestartDetector then check if the oldest restart record is pushed out from the queue. If no record was pushed out, there are less number of restarts than limit, so it is not intensive. If a record was pushed out, it means we had one more restarts than allowed. If the oldest restart and newest restart happened within allowed time interval, it is intensive.&This function implements pure part of T.Sthread-supervisor Get current system timestamp in a form.Tthread-supervisortDetermine if intensive restart is happening now. It is called when restart is triggered by some thread termination.Uthread-supervisor$Start a new thread with supervision.Vthread-supervisorStart all given % on new thread each with supervision.Wthread-supervisorEKill all running threads supervised by the supervisor represented by  .Xthread-supervisorCreate a supervisor with ( restart strategy and has no static 3. When it started, it has no child threads. Only Z{ can add new thread supervised by the supervisor. Thus the simple one-for-one supervisor only manages dynamic and  children.Ythread-supervisorCreate a supervisor.eWhen created supervisor IO action started, it automatically creates child threads based on given W list and supervise them. After it created such static children, it listens given  K. User can let the supervisor creates dynamic child thread by calling Z'. Dynamic child threads created by Z are also supervised.When the supervisor thread is killed or terminated in some reason, all children including static children and dynamic children are all killed.With j restart strategy, when a child thread terminated, it is restarted based on its restart type given in $. If the terminated thread has d restart type, supervisor restarts it regardless its exit reason. If the terminated thread has 8 restart type, and termination reason is other than   (meaning ! or "2), it is restarted. If the terminated thread has M restart type, supervisor does not restart it regardless its exit reason.Created IO action is designed to run in separate thread from main thread. If you try to run the IO action at main thread without having producer of the supervisor queue you gave, the supervisor will dead lock.Zthread-supervisorAAsk the supervisor to spawn new temporary child thread. Returns h of the new child.thread-supervisorReason of thread termination.thread-supervisorID of terminated thread.6thread-supervisor*Write-end of target actor's message queue.thread-supervisorMessage to be sent.7thread-supervisor Inbox the message to be send to.thread-supervisorMessage to be sent.8thread-supervisor*Write-end of target actor's message queue.thread-supervisorMessage to be sent.9thread-supervisor Inbox the message to be send to.thread-supervisorMessage to be sent.;thread-supervisor(Predicate to pick a interesting message.thread-supervisor5Message queue where interesting message searched for.<thread-supervisor(Predicate to pick a interesting message.thread-supervisor5Message queue where interesting message searched for.>thread-supervisori1 holding current number of messages in the queue.thread-supervisor!TVar to hold given new saveStack.thread-supervisor#New saveStack to update given TVar.Athread-supervisor%IO action handling received messages.Bthread-supervisor&Maximum length of inbox message queue.thread-supervisor%IO action handling received messages.Cthread-supervisor#Initial state of the state machine.thread-supervisorGMessage handler which processes event and returns result or next state.Ethread-supervisor#Message queue of the target server.thread-supervisorRequest to the server.Fthread-supervisorTimeout.thread-supervisor#Message queue of the target server.thread-supervisor0Request to the server without callback supplied.Gthread-supervisorTimeout.thread-supervisorMessage queue.thread-supervisor0Request to the server without callback supplied.thread-supervisorKcallback to process return value of the call. Nothing is given on timeout.Hthread-supervisor#Message queue of the target server.thread-supervisor0Request to the server without callback supplied.Lthread-supervisorRestart type of resulting  . One of ,  or .thread-supervisor,User supplied monitored IO action which the  actually does.Mthread-supervisorRestart type of resulting  . One of ,  or .thread-supervisor"User supplied IO action which the  actually does.Nthread-supervisor3Callback function called when the IO action of the  terminated.thread-supervisor Existing  where the  is going to be added.thread-supervisorNewly created  with the  added.Pthread-supervisorFMap of current live threads where the new thread is going to be added.thread-supervisor&Specification of newly started thread.thread-supervisorThread ID of forked thread.Rthread-supervisorNIntense restart detector containing history of past restart with maxT and maxRthread-supervisorSystem timestamp in a* form when the last restart was triggered.thread-supervisorReturns jw if intensive restart is happening. Returns new history of restart which has the oldest history removed if possible.Tthread-supervisorOIntense restart detector containing history of past restart with maxT and maxR.Uthread-supervisor&Inbox message queue of the supervisor.thread-supervisor:Map of current live threads which the supervisor monitors.thread-supervisor0Specification of the child thread to be started.Vthread-supervisor&Inbox message queue of the supervisor.thread-supervisor:Map of current live threads which the supervisor monitors.thread-supervisor+List of child specifications to be started.Ythread-supervisor+Restarting strategy of monitored threads.  or .thread-supervisor:Restart intensity sensitivity in restart count and period.thread-supervisor(List of supervised child specifications.Zthread-supervisorRequest timeout in microsecond.thread-supervisor8Inbox message queue of the supervisor to ask new thread.thread-supervisor+Child specification of the thread to spawn.U "! #$%&')(*+,-./0432156789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZU/04321-.+,56789:;<=>?@*&')(ABCD%E#$FGH"! IJKLMNOPQRST UVWXYZ(c) Naoto Shimazaki 2018-2020MIT (see the file LICENSE)https://github.com/nshimaza experimentalNone(;  !"#$%&'()*+/6789:;<?@ABCDEFGHIJKLMNQRTXYZ;/+6789:?@;<*&'()AB !"IKJMLNQRT YXZCD#$%EFGHSafe>klmnopqrs      !"#$%&''())*+,--..//0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab`acdefghigjkgjlmnogpqgprstuvwxyz{|}~0thread-supervisor-0.2.0.0-Csy2lzagcSM9Z6R4m9WtIBData.DelayedQueue%Control.Concurrent.SupervisorInternalUnliftIOwaitControl.Concurrent.SupervisorPaths_thread_supervisor DelayedQueuenewEmptyDelayedQueuepushpop$fEqDelayedQueue$fShowDelayedQueueStrategy OneForOne OneForAllSupervisorInboxSupervisorQueueSupervisorMessageDown StartChildIntenseRestartDetectorintenseRestartDetectorPeriodintenseRestartDetectorHistoryRestartSensitivityrestartSensitivityIntensityrestartSensitivityPeriod ThreadMap ChildSpecRestart Permanent Transient TemporaryMonitoredActionMonitor ExitReasonNormalUncaughtExceptionKilled CallTimeoutServerCallbackActor actorQueue actorAction ActorHandlerActorQ InboxLengthInbox inboxQueue inboxLengthinboxSaveStack inboxMaxBoundnewInboxsendsendToMetrySend trySendToMelength receiveSelecttryReceiveSelectpickFromSaveStackoneMessageRemovedreceive tryReceivenewActornewBoundedActornewStateMachinenewStateMachineActorcastcall callAsync callIgnorewatchnoWatch nestWatchnewMonitoredChildSpec newChildSpec addMonitor newThreadMap newThreadnewIntenseRestartDetectordetectIntenseRestartgetCurrentTimedetectIntenseRestartNownewSupervisedThreadstartAllSupervisedThreadkillAllSupervisedThreadnewSimpleOneForOneSupervisor newSupervisornewChild$fDefaultInboxLength$fDefaultCallTimeout$fDefaultRestartSensitivity$fShowExitReason $fEqRestart $fShowRestart clock-0.8-H1S1zDefxirImaRbI6ITNv System.Clock MonotonicTimeSpec%unliftio-0.2.13-GPpH6mbMidHXkIz8WTxC3UnliftIO.ConcurrentforkIOWithUnmaskbase GHC.MaybeNothing Data.EitherRightLeft"async-2.2.2-JNOgs3QkEuXLm97AkAPhACControl.Concurrent.AsyncAsync GHC.Conc.SyncThreadIdTVarghc-prim GHC.TypesTrueversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName