Jump to content

Events: Difference between revisions

Replaced "cpuTime" by "getTime" to get elapsed time and take sleeping time in account.
(Updated to compile with Nim 1.4: replaced "wait x" by "wait(addr x)".)
(Replaced "cpuTime" by "getTime" to get elapsed time and take sleeping time in account.)
Line 703:
<lang nim>import locks
from os import sleep
fromimport times import cpuTime
from strformat import fmt
 
Line 714:
proc waiting {.thread.} =
echo "spawned waiting proc"
let start = cpuTimegetTime()
cond.wait lock
echo fmt"thread ended after waiting: {cpuTimegetTime() - start} seconds."
 
proc main =
Line 737:
spawned waiting proc
send signal/event notification
thread ended after waiting: 1.001 secondssecond, 61 microseconds, and 311 nanoseconds.</pre>
 
=={{header|Oforth}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.