apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikolay Kuznetsov <nikolay.kuznet...@gmail.com>
Subject apr_thread_mutex error checking question
Date Wed, 15 Feb 2006 17:40:55 GMT
While implementing a library on top of APR I've ran into the problem
that APR thread_mutex does not perform error checking, in particular,
it doesn't check ownership of the mutex while releasing it.

There are several, I'd say, inconveniences connected with this, and
the main one is debugging, the behavior of the threads trying to lock
mutexes that was unlocked incorrectly is hardly predictable.

In my particular case, as I have wrappers around APR mutexes, so I can
easily implement those checks but for people who use APR as their
threading lib that can turn to a problem.

The question is if there are any particular reasons that there is no
option (mutex attributes?), switching this check on? POSIX threads
mutexes, for instance, have PTHREAD_MUTEX_ERRORCHECK attribute to
perform such checks. Win32 CRITICAL_SECTION also has owner field that
could be checked on unlock.

Nikolay Kuznetsov, Intel Middleware Products Division

View raw message