You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jonathan Gold <jg...@panix.com> on 2003/11/04 20:02:11 UTC

can someone confirm or deny my interpretation of global mutices?

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);

Re: can someone confirm or deny my interpretation of global mutices?

Posted by Jonathan Gold <jg...@panix.com>.
indeed it does use APR_USE_SYSVSEM_SERIALIZE. thanks for looking.

jon

On Tue, 4 Nov 2003, Jeff Trawick wrote:

> Jonathan Gold wrote:
>
> > 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.
>
> correct
>
> your Linux build is probably defaulting to SysV semaphores*, and mod_rewrite
> uses the default mutex type; thus, there is no file associated with that
> mod_rewrite mutex
>
> *verify by seeing if apachectl -V displays "-D APR_USE_SYSVSEM_SERIALIZE"
>

Re: can someone confirm or deny my interpretation of global mutices?

Posted by Jeff Trawick <tr...@attglobal.net>.
Jonathan Gold wrote:

> 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.

correct

your Linux build is probably defaulting to SysV semaphores*, and mod_rewrite 
uses the default mutex type; thus, there is no file associated with that 
mod_rewrite mutex

*verify by seeing if apachectl -V displays "-D APR_USE_SYSVSEM_SERIALIZE"