|
1 | 1 | (** Basic communication and synchronization primitives for {!Picos}. |
2 | 2 |
|
3 | | - The optional [padded] argument taken by several constructor functions, e.g. |
4 | | - {!Mutex.create} and {!Condition.create}, defaults to [false]. When |
5 | | - explicitly specified as [~padded:true] the object is allocated in a way to |
6 | | - avoid {{:https://en.wikipedia.org/wiki/False_sharing} false sharing}. For |
7 | | - relatively long lived objects this can improve performance and make |
8 | | - performance more stable at the cost of using more memory. It is not |
9 | | - recommended to use [~padded:true] for short lived objects. *) |
| 3 | + This library essentially provides a conventional set of communication and |
| 4 | + synchronization primitives for concurrent programming with any Picos |
| 5 | + compatible scheduler. |
| 6 | +
|
| 7 | + For the {{!examples} examples} we open some modules: |
| 8 | +
|
| 9 | + {[ |
| 10 | + open Picos_structured |
| 11 | + open Picos_sync |
| 12 | + ]} *) |
10 | 13 |
|
11 | 14 | (** {1 Modules} *) |
12 | 15 |
|
|
255 | 258 |
|
256 | 259 | (** {1 Examples} |
257 | 260 |
|
258 | | - First we open some modules for convenience: |
259 | | -
|
260 | | - {[ |
261 | | - open Picos_structured |
262 | | - open Picos_sync |
263 | | - ]} |
264 | | -
|
265 | 261 | {2 A simple bounded queue} |
266 | 262 |
|
267 | 263 | Here is an example of a simple bounded (blocking) queue using a mutex and |
|
378 | 374 | Notice how the producer was able to push three elements to the queue after |
379 | 375 | which the fourth push blocked and the consumer was started. Also, after |
380 | 376 | canceling the consumer, the queue could still be used just fine. *) |
| 377 | + |
| 378 | +(** {1 Conventions} |
| 379 | +
|
| 380 | + The optional [padded] argument taken by several constructor functions, e.g. |
| 381 | + {!Mutex.create} and {!Condition.create}, defaults to [false]. When |
| 382 | + explicitly specified as [~padded:true] the object is allocated in a way to |
| 383 | + avoid {{:https://en.wikipedia.org/wiki/False_sharing} false sharing}. For |
| 384 | + relatively long lived objects this can improve performance and make |
| 385 | + performance more stable at the cost of using more memory. It is not |
| 386 | + recommended to use [~padded:true] for short lived objects. *) |
0 commit comments