summaryrefslogtreecommitdiffstats
path: root/doc/Thread.3
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-09-28 09:54:24 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-09-28 09:54:24 (GMT)
commitfd03d49b6f80c194e041a4c2d1364b4f46d59ff3 (patch)
treede0a3766b49eb1223936bbc26d54a979e4c709e7 /doc/Thread.3
parent29fbee578473c16fcabaa07b8995dbb3e3073930 (diff)
downloadtcl-fd03d49b6f80c194e041a4c2d1364b4f46d59ff3.zip
tcl-fd03d49b6f80c194e041a4c2d1364b4f46d59ff3.tar.gz
tcl-fd03d49b6f80c194e041a4c2d1364b4f46d59ff3.tar.bz2
Better phrasing from TIP 509
Diffstat (limited to 'doc/Thread.3')
-rw-r--r--doc/Thread.314
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/Thread.3 b/doc/Thread.3
index 59bf488..2005c93 100644
--- a/doc/Thread.3
+++ b/doc/Thread.3
@@ -137,17 +137,17 @@ Tcl provides \fBTcl_ThreadQueueEvent\fR and \fBTcl_ThreadAlert\fR
for handling event queuing in multithreaded applications. See
the \fBNotifier\fR manual page for more information on these procedures.
.PP
-A mutex is a
-.VS TIP509
-recursive
-.VE TIP509
-lock that is used to serialize all threads through a piece
+A mutex is a lock that is used to serialize all threads through a piece
of code by calling \fBTcl_MutexLock\fR and \fBTcl_MutexUnlock\fR.
If one thread holds a mutex, any other thread calling \fBTcl_MutexLock\fR will
block until \fBTcl_MutexUnlock\fR is called.
A mutex can be destroyed after its use by calling \fBTcl_MutexFinalize\fR.
-The result of locking a mutex twice from the same thread is undefined.
-On some platforms it will result in a deadlock.
+.VS TIP509
+Mutexes are reentrant: they can be locked several times from the same
+thread. However there must be exactly one call to
+\fBTcl_MutexUnlock\fR for each call to \fBTcl_MutexLock\fR in order
+for a thread to release a mutex completely.
+.VE TIP509
The \fBTcl_MutexLock\fR, \fBTcl_MutexUnlock\fR and \fBTcl_MutexFinalize\fR
procedures are defined as empty macros if not compiling with threads enabled.
For declaration of mutexes the \fBTCL_DECLARE_MUTEX\fR macro should be used.