ch: Channel functions

Top  Previous  Next

The "Channel" communication mechanism is a FIFO queue mechanism that can be used for passing messages between threads.

 

A message is defined as an arbitrary block of data with a given length. The channel is initialized with chInit(), and the maximum number of messages in the channel is specified. A message is written to a channel by using chWrite() and read using chRead(). The Channel mechanism will automatically synchronize the access to the channel so that reading from an empty channel will block the calling thread until a message is written. Writing to a full channel will also block the calling thread until a message has been read.

 

Please refer to the section on Using Multithreading for more information on the use of channels.

 

The following channel functions exists:

 


chInit

Initializes a channel.


chDestroy

Destroys a channel.


chStatus

Queries a channel for its status.


chRead

Reads data from a channel.


chWrite

Writes data to a channel.


chPeek

Takes a peek at the first message in the channel.

 

 
The following resource limitations apply:

X32 Execution Architecture:

Maximum 16 channels with a total message size of 19 Kbytes.

NX32 Execution Architecture:

Maximum 32 channels with a total message size of 39 Kbytes.

NX32L Execution Architecture:

Maximum 128 channels with a total message size of 256 Kbytes.

 

The total message size available is for all channels combined. Each message occupies the size of the message + an overhead of 10 bytes.
With a message size of 10 bytes, a total of 13107 messages (256 Kbyte / (10+10)) can be present in an NX32L based system.