/tutorial/sequencer/example2.e
Specman e | 38 lines | 28 code | 7 blank | 3 comment | 1 complexity | 5e235d569f7cbf7ac7fe900ded70003e MD5 | raw file
1class EXAMPLE2 2 -- Second example that shows how to do multiple cooperative jobs in 3 -- parallel. The job is created with inline create and parameter 4 -- given to the job. 5 6create {ANY} 7 make 8 9feature {} 10 lm: LOOP_STACK 11 12 counter: INTEGER 13 14 make 15 do 16 create lm.make 17 lm.add_job(create {SIMPLE_BACKGROUND_JOB}.set_work(agent running("%R-"), Void, 1)) 18 lm.add_job(create {SIMPLE_BACKGROUND_JOB}.set_work(agent running("%R/"), Void, 1)) 19 lm.add_job(create {SIMPLE_BACKGROUND_JOB}.set_work(agent running("%R|"), Void, 1)) 20 lm.add_job(create {SIMPLE_BACKGROUND_JOB}.set_work(agent running("%R\"), Void, 1)) 21 lm.run 22 end 23 24 running (s: STRING): BOOLEAN 25 do 26 io.put_string(s) 27 io.flush 28 counter := counter + 1 29 if counter \\ 100 = 0 then 30 io.put_string("%Ncounter = ") 31 io.put_integer(counter) 32 io.put_new_line 33 end 34 35 Result := counter < 1000 36 end 37 38end -- class EXAMPLE2