Commit d0017b37 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Improve documentation.

parent 0d65478e
......@@ -5,4 +5,44 @@ BLC channel
- Author : [Arnaud Blanchard](
- Licence : [CeCILL v2.1](
See [online documentation](
\ No newline at end of file
Functions to easily share data through shared memory (shm_... functions). The advantage is that it is the fastest and the more econom in memory ( no copy in each process ) way to share informtation between processes. At this moment in anly works in asynchronous mode.
The idea is that you hav ae structure blc_channel which is like a blc_array ( ) but has a name starting with '/' to identificate it on your system.
For exemple you create a channel in one program to write data:
#Creating shared called '/my_channel_name', this program will write on it, it is char ('INT8') with no specific format ('NDEF') of dimension 1 (vector) of 32 elements.
blc_channel my_channel.create("/my_channel_name", BLC_CHANNEL_WRITE, 'INT8', 'NDEF', 1, 32);
snprintf(my_channel.chars, 32, "Hello world !\n");
and read this data in another program:
#Opening shared memory called '/my_channel_name', this program will only read it.
blc_channel"/my_channel_name", BLC_CHANNEL_READ);
printf("%s", my_receiving_channel.chars);
The second program prints 'Hello world !'.
`blc_channel/` launches two processes.
- **t_channel_reader** reading each second the content of '/channel_example' and printing it.
- **t_channel_writer** waiting for the user to enter text and filing the channel '/channel_example' with this text. Each second the reader will print this text.
Press 'q' to quit.
The information about the properties of the blc_channels (type, format, sizes) is stored in a special file: '/tmp/blc_channels.txt'. You are not suppose to use it but you can check at anytime the status of the blc_channels using `./ i_channels` in your blaar directory.
You will see all the existing blc_channels, the process reading or writing and the possibility to destroy channels.
On Linux we can see and manipulate a virtual file containing this memory in /run/shm/<name of your shared memory>, on OSX you cannot but anyway it is only used for debug.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment