From 68e88433fc8ce075b3e82f969b0738430f2ffdae Mon Sep 17 00:00:00 2001 From: Davis King Date: Fri, 28 Dec 2012 19:14:31 -0500 Subject: [PATCH] Changed the spec for mutex::unlock() to say that it is illegal for a thread to unlock a dlib::mutex it doesn't own. This is technically a non-backwards compatible change to the API but it has always been implemented in a way that didn't allow this kind of double unlock() on non-Windows platforms. Additionally, the recent change to the dlib::mutex implementation on windows also no longer allows this kind of double unlock. --- dlib/threads/threads_kernel_abstract.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dlib/threads/threads_kernel_abstract.h b/dlib/threads/threads_kernel_abstract.h index 4dfb04963..d88d37dad 100644 --- a/dlib/threads/threads_kernel_abstract.h +++ b/dlib/threads/threads_kernel_abstract.h @@ -175,11 +175,10 @@ namespace dlib void unlock ( ) const; /*! + requires + - the thread calling unlock() already has a lock on *this ensures - - if (*this is currently locked and owned by the thread calling unlock) then - - #*this is unlocked (i.e. other threads may now lock this object) - - else - - the call to unlock() has no effect + - #*this is unlocked (i.e. other threads may now lock this object) !*/