Yonatan wrote at 2020-3-11 16:24 +0200:
>That code I'm talking about didn't require a reentrant lock - the
>algorithm really wasn't reentrant.
>
>Let me clarify my point: I'm wondering why the non-reentrant lock
>doesn't raise an exception immediately on this
>erroneous situation.
>I thought it could be altered, or at least we could add an option to
>let a `threading.Lock` behave like a pthread
>mutex in mode `PTHREAD_MUTEX_ERRORCHECK`: Disallow double locking by
>same thread, disallow unlocking
>by another thread.

The documentation for the basic lock explicitely allows
lock release by a foreign thread.
As I understand the documentation, this lock type is by design
very basic - a mechanism to implement higher level abstractions.
I use other synchronisation mechanisms when the basic lock does
not fit my requirements.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to