PageRenderTime 3ms CodeModel.GetById 1ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/sequencer/example1.e

http://github.com/tybor/Liberty
Specman e | 45 lines | 35 code | 9 blank | 1 comment | 1 complexity | 5a80f7dce89f3e08a1028b6f935d4bbb MD5 | raw file
 1class EXAMPLE1
 2   -- Simple example that shows how to do multiple cooperative jobs in parallel.
 3
 4create {ANY}
 5   make
 6
 7feature {}
 8   lm: LOOP_STACK
 9
10   counter: INTEGER
11
12   continue: BOOLEAN
13
14   make
15      local
16         job1, job2: SIMPLE_BACKGROUND_JOB
17      do
18         create lm.make
19         create job1.set_work(agent work1, Void, 1)
20         create job2.set_work(agent work2, Void, 1)
21         lm.add_job(job1)
22         lm.add_job(job2)
23         continue := True
24         lm.run
25      end
26
27   work1: BOOLEAN
28      do
29         io.put_integer(counter)
30         io.put_new_line
31         counter := counter + 1
32         if counter > 5 then
33            continue := False
34         end
35
36         Result := continue
37      end
38
39   work2: BOOLEAN
40      do
41         io.put_string("Hello !%N")
42         Result := continue
43      end
44
45end -- class EXAMPLE1