Metered concurrency: Difference between revisions
Content deleted Content added
Line 96:
end Semaphores_Main;
=={{header|ALGOL 68}}==
SEMA sem = LEVEL 1;
PROC job = (INT n)VOID: (
printf(($" Job "d" acquired Semaphore ..."$,n));
TO 10000000 DO SKIP OD;
printf(($" Job "d" released Semaphore"l$,n))
);
PAR (
( DOWN sem ; job(1) ; UP sem ) ,
( DOWN sem ; job(2) ; UP sem ) ,
( DOWN sem ; job(3) ; UP sem )
)
Output:
Job 1 acquired Semaphore ... Job 1 released Semaphore
Job 3 acquired Semaphore ... Job 3 released Semaphore
Job 2 acquired Semaphore ... Job 2 released Semaphore
=={{header|D}}==
<d>module meteredconcurrency ;
|