hasim-0.1.2: Process-Based Discrete Event Simulation library

Portabilityunportable
Stabilityexperimental
Maintainerjochem@functor.nl

Control.Hasim.Action

Contents

Description

Convenience functions and shadowing of API internals. Likely to be a more stable interface then Control.Hasim.Process.

Synopsis

Time

getTime :: Action pkt st TimeSource

Get the current time. The result will be nonnegative.

Waiting

waitSource

Arguments

:: Time

The time period we wait. Must be nonnegative.

-> Action pkt st () 

Wait for a nonnegative time period.

waitForever :: Action pkt st ()Source

Wait forever. This can be useful in case you want to block, waiting for incoming packets.

Sending

sendSource

Arguments

:: pkt

The packet we send.

-> Proc pkt st

The receiver process

-> Time

The timeout. Must be nonnegative.

-> Action pkt' st' Bool 

Send a packet to a process, with a timeout time interval. Returns True iff the packet was accepted.

trySendSource

Arguments

:: pkt

The packet we send

-> Proc pkt st

The receiver process

-> Action pkt' st' Bool 

Send a packet. Return True iff the packet was accepted immediately. Do not wait in case the packet was not accepted.

sendBlockSource

Arguments

:: pkt

The packet we send

-> Proc pkt st

The receiver process

-> Action pkt' st' () 

Send a packet. Wait as long as necessary to deliver the packet.

Receiving

withAcceptorSource

Arguments

:: Acceptor pkt st

The acceptor to set

-> Action pkt st ()

The action to be executed

-> Action pkt st () 

Execute an action with an Acceptor function

withoutInterruptions :: Action pkt st () -> Action pkt st ()Source

Execute an action without interruptions from incoming packets.

receive :: Action pkt st pktSource

Receive a packet. Block until the first packet comes in.

poll :: Action pkt st (Maybe pkt)Source

Receive a packet, non-blocking.