# Module channels

Channel support for threads. Note: This is part of the system module. Do not import it directly. To activate thread support you need to compile with the `--threads:on` command line switch.

Note: The current implementation of message passing is slow and does not work with cyclic data structures.

# Types

    TChannel*[TMsg] = TRawChannel

  a channel for thread communication

# Procs

    proc send*[TMsg](c: var TChannel[TMsg]; msg: TMsg)

  sends a message to a thread. msg is deeply copied.

    proc recv*[TMsg](c: var TChannel[TMsg]): TMsg

  receives a message from the channel c. This blocks until a message has arrived! You may use `peek` to avoid the blocking.

    proc peek*[TMsg](c: var TChannel[TMsg]): int

  returns the current number of messages in the channel c. Returns -1 if the channel has been closed.

    proc open*[TMsg](c: var TChannel[TMsg])

  opens a channel c for inter thread communication.

    proc close*[TMsg](c: var TChannel[TMsg])

  closes a channel c and frees its associated resources.

    proc ready*[TMsg](c: var TChannel[TMsg]): bool

  returns true iff some thread is waiting on the channel c for new messages.

Generated: 2012-09-23 21:47:54 UTC