/tutorial/sequencer/example2.e
http://github.com/tybor/Liberty · Specman e · 38 lines · 28 code · 7 blank · 3 comment · 1 complexity · 5e235d569f7cbf7ac7fe900ded70003e MD5 · raw file
- class EXAMPLE2
- -- Second example that shows how to do multiple cooperative jobs in
- -- parallel. The job is created with inline create and parameter
- -- given to the job.
- create {ANY}
- make
- feature {}
- lm: LOOP_STACK
- counter: INTEGER
- make
- do
- create lm.make
- lm.add_job(create {SIMPLE_BACKGROUND_JOB}.set_work(agent running("%R-"), Void, 1))
- lm.add_job(create {SIMPLE_BACKGROUND_JOB}.set_work(agent running("%R/"), Void, 1))
- lm.add_job(create {SIMPLE_BACKGROUND_JOB}.set_work(agent running("%R|"), Void, 1))
- lm.add_job(create {SIMPLE_BACKGROUND_JOB}.set_work(agent running("%R\"), Void, 1))
- lm.run
- end
- running (s: STRING): BOOLEAN
- do
- io.put_string(s)
- io.flush
- counter := counter + 1
- if counter \\ 100 = 0 then
- io.put_string("%Ncounter = ")
- io.put_integer(counter)
- io.put_new_line
- end
- Result := counter < 1000
- end
- end -- class EXAMPLE2