-
Notifications
You must be signed in to change notification settings - Fork 1
/
example4.rcp
54 lines (35 loc) · 1.04 KB
/
example4.rcp
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
channels: a, b
enum msgvals {get, msg1, msg2}
message-structure: MSG : msgvals
communication-variables: asgn : bool
agent Buffer
local: m1 : int, m2 : int
init: m1 == 0 && m2 == 0
relabel:
asgn <- false
receive-guard: TRUE
repeat: (
<(m1 > 0)> *! (TRUE)
(MSG := msg1)[m1:= m1 - 1]
+
<(m2 > 0)> *! (TRUE)
(MSG := msg2)[m2:= m2 - 1]
+
<(m1 > 0)> b? [m1:= m1 + 1]
+
<(m2 > 0)> b? [m2:= m2 + 1]
)
agent Producer
local: size : int, no : int
init: size == 4 && no == 0
relabel:
asgn <- false
receive-guard: TRUE
repeat: (
<TRUE> b! (TRUE)
(MSG := msg1)[]
+
<TRUE> b! (TRUE)
(MSG := msg2)[]
)
system = Buffer(one,TRUE) | Producer(two,TRUE) | Producer(three,TRUE)