restricted-workers-0.1.0: Running worker processes under system resource restrictions

Safe HaskellNone

System.Restricted.Worker.Internal

Contents

Description

Library exposing internal functions uses by Worker useful work writing your own workers

Synopsis

Worker related

killWorker :: Worker a -> IO (Worker a)Source

Kill a worker. Takes an initialized worker, returns non-initialized one.

workerAlive :: Worker a -> IO BoolSource

Checks whether the worker is alive

workerTimeoutSource

Arguments

:: Worker a

ID of a process to be killed

-> Int

Time limit (in seconds)

-> IO (Worker a) 

Waits for a certain period of time and then kills the worker

forkWorkerSource

Arguments

:: Worker a 
-> Maybe (IO Handle)

Where to redirect stdout

-> (Socket -> IO ())

Callback funcion

-> IO ProcessID 

Fork a worker process

Connection related

connectToWorker :: Worker a -> IO HandleSource

Connect to the worker's socket and return a handle

mkSock :: FilePath -> IO SocketSource

Create a new unix socket

Useful util functions

removeFileIfExists :: FilePath -> IO ()Source

Remove a file if it exists. Should be thread-safe.

processAlive :: ProcessID -> IO BoolSource

Checks whether the process is alive hacky