Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
8
Task/Metered-concurrency/Zkl/metered-concurrency.zkl
Normal file
8
Task/Metered-concurrency/Zkl/metered-concurrency.zkl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fcn job(name,sem){
|
||||
name.println(" wait"); sem.acquire();
|
||||
name.println(" go"); Atomic.sleep(2);
|
||||
sem.release(); name.println(" done")
|
||||
}
|
||||
// start 3 threads using the same semphore
|
||||
s:=Thread.Semaphore(1);
|
||||
job.launch("1",s); job.launch("2",s); job.launch("3",s);
|
||||
Loading…
Add table
Add a link
Reference in a new issue