httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Gold <jg...@panix.com>
Subject can someone confirm or deny my interpretation of global mutices?
Date Tue, 04 Nov 2003 19:02:11 GMT
when i first started using 2.0.47, i was concerned that mod_rewrite no
longer wrote a visible lockfile when using RewriteLock with an
external map program. i realize there was some type of bug related to
this in 2.0.39 ( 9534 --
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9534 ), which is
marked as having been fixed in 2.0.41. i still saw no lockfile being
created, so i looked around in the source code to see what's
happening.

i'm not a great C programmer, but i think i understand, from the
comments on the method which creates the mutex, that an actual file is
used only if the operating system needs it to implement the locking.
might there be someone on this list more familiar with the linux
locking systems and the source code to confirm that this is how things
are working?

jon

from 'apr_global_mutex.h':

/*
 * Create and initialize a mutex that can be used to synchronize both
 * processes and threads. Note: There is considerable overhead in
 * using this API if only cross-process or cross-thread mutual
 * exclusion is required. See apr_proc_mutex.h and apr_thread_mutex.h
 * for more specialized lock routines.
 * @param mutex the memory address where the newly created mutex
 * will be stored.
 * @param fname A file name to use if the lock mechanism
 * requires one.  This argument should always be provided.  The lock
 * code itself will determine if it should be used.
 * @param mech The mechanism to use for the interprocess
 * lock, if any; one of
 * <PRE>
 *            APR_LOCK_FCNTL
 *            APR_LOCK_FLOCK
 *            APR_LOCK_SYSVSEM
 *            APR_LOCK_POSIXSEM
 *            APR_LOCK_PROC_PTHREAD
 *            APR_LOCK_DEFAULT     pick the default
 *            mechanism for the platform
 * </PRE>
 * @param pool the pool from which to allocate the
 * mutex.
 * @warning Check APR_HAS_foo_SERIALIZE defines to
 * see if the platform supports APR_LOCK_foo.  Only APR_LOCK_DEFAULT
 * is portable.
 */
 APR_DECLARE(apr_status_t)
 apr_global_mutex_create( apr_global_mutex_t **mutex,
                          const char *fname,
                          apr_lockmech_e mech,
                          apr_pool_t *pool);

Mime
View raw message