apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ch...@potamus.org
Subject error checking for apr_thread_mutex_lock()?
Date Mon, 13 Sep 2004 22:14:49 GMT

According to the Apache 2.1 project plan [1], one of
the goals is to "check returns from all system calls:
read, write, etc." However, in the Apache and APR code,
I see that almost no one checks whether the thread
mutex lock functions return an error apr_status_t.

Can we safely assume that all calls to 
apr_thread_mutex_lock() will (eventually) succeed? If
so, then apr_thread_mutex_lock() could just return
void. However, I know apr_thread_mutex_lock() CAN fail
(in rare circumstances) on Win32. Microsoft's MSDN docs
for EnterCriticalSection() [2] say that this API can
raise an exception during low-memory or deadlock. So if
APR wants to be VERY careful about error-handling, then
Win32's apr_thread_mutex_lock() might want to wrap
EnterCriticalSection() in a "structured exception
handling" __try/__catch block to catch these exceptions.

Would this error-handling be too pedantic? I think
these EnterCriticalSection() errors would only happen
during high contention for locks when kernel memory is

btw, I've been following APR development for a while
and it looks great! <:)


[1] http://httpd.apache.org/dev/project-plan.html


View raw message