RosettaCodeData/Task/Metered-concurrency/Factor/metered-concurrency.factor

13 lines
331 B
Factor
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
USING: calendar calendar.format concurrency.combinators
concurrency.semaphores formatting kernel sequences threads ;
10 <iota> 2 <semaphore>
[
[
dup now timestamp>hms
"task %d acquired semaphore at %s\n" printf
2 seconds sleep
] with-semaphore
"task %d released\n" printf
] curry parallel-each