blob: bdff6acbe3f950d630ce71faf075ef55da576f63 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
init:
Select a filename.
Create XSI semaphore array {S = 0, W = 0, X = 1 and Q = 0}
with random key. Store the semaphore array's key in
decimal form on the first line in the selected file.
Create XSI shared memory, with an allocation of 2048 bytes,
with a random key. Store the shared memory's key in
decimal form on the second line in the selected file.
broadcast:
with P(X):
Z(W)
Write NUL-terminate message to shared memory
Q := 0
Z(S)
listen:
V(S) with undo on exit
forever:
V(Q)
Z(Q)
Read NUL-terminated message from shared memory
if breaking:
P(S) with undo on exit
break
with V(W):
with P(S):
Z(S)
|