RosettaCodeData/Task/Mutex/Tcl/mutex-1.tcl

14 lines
287 B
Tcl
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
package require Thread
# How to create a mutex
set m [thread::mutex create]
# This will block if the lock is already held unless the mutex is made recursive
thread::mutex lock $m
# Now locked...
thread::mutex unlock $m
# Unlocked again
# Dispose of the mutex
thread::mutex destroy $m