LogicGrowsOnTrees-1.0.0.0.1: a parallel implementation of logic programming using distributed tree exploration

Safe HaskellNone

LogicGrowsOnTrees.Parallel.Common.Process

Contents

Description

This module contains functions that let one easily implement the worker side of an adapter under the assumption that the worker uses a two-way communication channel with the supervisor for sending and receiving messages. (Examples of when this is NOT the case is the threads adapter, where you can communicate with the worker threads directly, and the MPI adapter, which has communication primitives that don't quite align with this setup.)

Synopsis

Exceptions

data ConnectionLost Source

This exception is thrown when the connection has been lost.

Constructors

ConnectionLost 

Functions

runWorkerSource

Arguments

:: forall exploration_mode m n .  
=> ExplorationMode exploration_mode

the mode in to explore the tree

-> Purity m n

the purity of the tree

-> TreeT m (ResultFor exploration_mode)

the tree

-> IO MessageForWorker

the action used to fetch the next message

-> (MessageForSupervisorFor exploration_mode -> IO ())

the action to send a message to the supervisor; note that this might occur in a different thread from the worker loop

-> IO () 

Runs a loop that continually fetches and reacts to messages from the supervisor until the worker quits.

runWorkerUsingHandlesSource

Arguments

:: (Serialize (ProgressFor exploration_mode), Serialize (WorkerFinishedProgressFor exploration_mode)) 
=> ExplorationMode exploration_mode

the mode in to explore the tree

-> Purity m n

the purity of the tree

-> TreeT m (ResultFor exploration_mode)

the tree

-> Handle

handle from which messages from the supervisor are read

-> Handle

handle to which messages to the supervisor are written

-> IO () 

The same as runWorker, but it lets you provide handles through which the messages will be sent and received. (Note that the reading and writing handles might be the same.)