httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <stodd...@raleigh.ibm.com>
Subject APR locks
Date Fri, 01 Oct 1999 12:58:28 GMT
The APR lock API is trying to hide too many details of the underlying code
for my taste. The current lock create call looks like this:

ap_create_lock(ap_context_t *, ap_locktype_e, ap_lockscope_e, char *,
ap_lock_t **)
where
ap_locktype_w is APR_MUTEX, APR_READWRITE
ap_lockscope_e is APR_CROSS_PROCESS, APR_INTRAPROCESS, APR_LOCKALL
char * is a lock name
ap_lock_t is the lock structure

The definition of ap_lock_t on Unix depend on the serialization #define
(PTHREAD, FCNTL, FLOCK, etc). ap_lock_t must contain the undelying lock
typedefs, e.g., on Win32, a mutex (cross process) and a critical section
(intra process). This structure also requires a runtime check each lock
operation to determine the lock scope. Too many details hidden which can
lead to subtle bugs. I'm thinking a seperate APIs for inter-process locking
and intra-process locking is preferable. The underlying implementation would
be simpler and it will be obvious looking at the code what kind of lock is
being used. Thoughts?

BTW,  ap_create_mutex(), et. al are #defined to (0) in apr_lib.h,  so
apr_pools are not being serialized.

Bill Stoddard




Mime
View raw message