repo.or.cz
/
linux
/
fpc-iii.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
WIP FPC-III support
[linux/fpc-iii.git]
/
tools
/
memory-model
/
litmus-tests
/
MP+poonceonces.litmus
blob
9f9769d647c7bb787e5ce9339ec8414541f53067
1
C MP+poonceonces
2
3
(*
4
* Result: Sometimes
5
*
6
* Can the counter-intuitive message-passing outcome be prevented with
7
* no ordering at all?
8
*)
9
10
{
11
int buf;
12
int flag;
13
}
14
15
P0(int *buf, int *flag) // Producer
16
{
17
WRITE_ONCE(*buf, 1);
18
WRITE_ONCE(*flag, 1);
19
}
20
21
P1(int *buf, int *flag) // Consumer
22
{
23
int r0;
24
int r1;
25
26
r0 = READ_ONCE(*flag);
27
r1 = READ_ONCE(*buf);
28
}
29
30
exists (1:r0=1 /\ 1:r1=0) (* Bad outcome. *)