resource test_sched_expr() op f(x : int) var global_var : int := 5 process service write("age=", age(), "process service will handle calls to f") do true -> write("age=", age(), "f: ready") in f(x) st global_var > x -> write("age=", age(), "f: x=", x, "global_var=", global_var) ni od end service nap(1000) write("age=", age(), "global_var=", global_var) nap(1000) send f(10) # in f(x) remains blocked nap(1000) global_var := 15 # in f(x) still blocked nap(1000) write("age=", age(), "global_var=", global_var) nap(1000) send f(20) # in f(x) takes f(10) but not f(20) nap(1000) global_var := 25 # in f(x) still blocked nap(1000) write("age=", age(), "global_var=", global_var) nap(1000) send f(1) # in f(x) takes both f(20) and f(1) nap(1000) write("age=", age(), "stopping") stop end test_sched_expr /* ............... Example compile and run(s) % sr -o test_sched_expr test_sched_expr.sr % ./test_sched_expr age= 15 process service will handle calls to f age= 21 f: ready age= 1019 global_var= 5 age= 4029 global_var= 15 age= 5040 f: x= 10 global_var= 15 age= 5045 f: ready age= 7039 global_var= 25 age= 8050 f: x= 20 global_var= 25 age= 8053 f: ready age= 8054 f: x= 1 global_var= 25 age= 8055 f: ready age= 9049 stopping */