From db034c5228345497d775ab000b3cd19560f170c1 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Sun, 8 Mar 2009 12:56:48 +0000 Subject: [PATCH] document that locking a wxMutex or a wxCriticalSection twice from the same thread doesn't result in a deadlock git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- interface/wx/thread.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/interface/wx/thread.h b/interface/wx/thread.h index 0d27327b25..3dcb9f3f2a 100644 --- a/interface/wx/thread.h +++ b/interface/wx/thread.h @@ -535,11 +535,17 @@ public: ~wxCriticalSection(); /** - Enter the critical section (same as locking a mutex). - + Enter the critical section (same as locking a mutex): if another thread + has already entered it, this call will block until the other thread + calls Leave(). There is no error return for this function. - After entering the critical section protecting some global - data the thread running in critical section may safely use/modify it. + + After entering the critical section protecting a data variable, + the thread running inside the critical section may safely use/modify it. + + Note that entering the same critical section twice or more from the same + thread doesn't result in a deadlock; in this case in fact this function will + immediately return. */ void Enter(); @@ -1506,6 +1512,9 @@ public: Locks the mutex object. This is equivalent to LockTimeout() with infinite timeout. + Note that if this mutex is already locked by the caller thread, + this function doesn't block but rather immediately returns. + @return One of: @c wxMUTEX_NO_ERROR, @c wxMUTEX_DEAD_LOCK. */ wxMutexError Lock(); -- 2.45.2