mirror of https://github.com/Qortal/Brooklyn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
464 B
28 lines
464 B
C MP+pooncerelease+poacquireonce |
|
|
|
(* |
|
* Result: Never |
|
* |
|
* This litmus test demonstrates that smp_store_release() and |
|
* smp_load_acquire() provide sufficient ordering for the message-passing |
|
* pattern. |
|
*) |
|
|
|
{} |
|
|
|
P0(int *buf, int *flag) // Producer |
|
{ |
|
WRITE_ONCE(*buf, 1); |
|
smp_store_release(flag, 1); |
|
} |
|
|
|
P1(int *buf, int *flag) // Consumer |
|
{ |
|
int r0; |
|
int r1; |
|
|
|
r0 = smp_load_acquire(flag); |
|
r1 = READ_ONCE(*buf); |
|
} |
|
|
|
exists (1:r0=1 /\ 1:r1=0) (* Bad outcome. *)
|
|
|