Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- startEventloopSystem :: EventloopSetupConfiguration progstateT -> IO ()
- terminateWithinOrThrowException :: Int -> SomeException -> Thread -> IO TimerIO
- threadActionsBasedOnModule :: EventloopSystemConfiguration progstateT -> (EventloopSystemConfiguration progstateT -> (EventloopModuleConfiguration, resource) -> IO ()) -> (EventloopModuleConfiguration -> Maybe resource) -> [EventloopModuleConfiguration] -> [IO ()]
- spawnWorkerThread :: EventloopSystemConfiguration progstateT -> (EventloopSystemConfiguration progstateT -> Thread -> IO ()) -> IO () -> IO ()
- registerRetrieverThread :: EventloopSystemConfiguration progstateT -> Thread -> IO ()
- registerOutRouterThread :: EventloopSystemConfiguration progstateT -> Thread -> IO ()
- registerSenderThread :: EventloopSystemConfiguration progstateT -> Thread -> IO ()
- throwShutdownExceptionToThread :: Thread -> IO ()
- allWorkerThreads :: EventloopSystemConfiguration progstateT -> IO [Thread]
- retrieverThreads :: EventloopSystemConfiguration progstateT -> IO [Thread]
- outRouterThread :: EventloopSystemConfiguration progstateT -> IO [Thread]
- senderThreads :: EventloopSystemConfiguration progstateT -> IO [Thread]
Documentation
startEventloopSystem :: EventloopSetupConfiguration progstateT -> IO () Source #
Starts the entire system. First the setup phase is handled to setup the different concurrent resources. This is followed by the initialization phase where all modules are initialised. Than, the different worker threads are spawned and finally the system thread will go to work as the eventloop thread.
Shutting down is handled centrally through the system thread (main thread). If any of the threads(including the system thread) receive an exception, only the first exception is thrown to the system thread which will try to shutdown immediately. This exception is logged by the system thread. All other exceptions are logged by their respective threads. The system thread will than shutdown the worker threads. This is done by throwing exceptions to all workerthreads except sender threads. These are sent a Stop event. If they take longer than 1 second, to finish up, they will also be thrown an exception.
terminateWithinOrThrowException :: Int -> SomeException -> Thread -> IO TimerIO Source #
threadActionsBasedOnModule :: EventloopSystemConfiguration progstateT -> (EventloopSystemConfiguration progstateT -> (EventloopModuleConfiguration, resource) -> IO ()) -> (EventloopModuleConfiguration -> Maybe resource) -> [EventloopModuleConfiguration] -> [IO ()] Source #
Utility function in order to create the different thread actions in the system. Assumed is that the action requires the system configuration, the module configuration and some resource that may be available in the module configuration.
spawnWorkerThread :: EventloopSystemConfiguration progstateT -> (EventloopSystemConfiguration progstateT -> Thread -> IO ()) -> IO () -> IO () Source #
registerRetrieverThread :: EventloopSystemConfiguration progstateT -> Thread -> IO () Source #
registerOutRouterThread :: EventloopSystemConfiguration progstateT -> Thread -> IO () Source #
registerSenderThread :: EventloopSystemConfiguration progstateT -> Thread -> IO () Source #
throwShutdownExceptionToThread :: Thread -> IO () Source #
allWorkerThreads :: EventloopSystemConfiguration progstateT -> IO [Thread] Source #
retrieverThreads :: EventloopSystemConfiguration progstateT -> IO [Thread] Source #
outRouterThread :: EventloopSystemConfiguration progstateT -> IO [Thread] Source #
senderThreads :: EventloopSystemConfiguration progstateT -> IO [Thread] Source #