apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject apr_global_mutex_names(), similar to apr_proc_mutex_name()?
Date Mon, 23 Nov 2009 14:48:27 GMT
APR_DECLARE(void) apr_global_mutex_names(apr_global_mutex_t *mutex,
                                         const char **proc_mech,
                                         const char **thread_mech)
{
    *proc_mech = apr_proc_mutex_name(mutex->proc_mutex);
    *thread_mech = NULL;
#if APR_HAS_THREADS
    if (mutex->thread_mutex) {
        *thread_mech = "pthread";
    }
#endif
}

I'd like to be able to retrieve the selected mechanism(s) from a
global mutex like I can for a proc mutex, but somehow this is not a
very satisfying interface.

Also, Win32 and others wouldn't be able to

#define apr_global_mutex_names  apr_proc_mutex_names

like they can for other global mutex functions.

--/--

Since thread mechanisms aren't configurable/selectable, there is
limited value in returning the name of the thread mechanism, so this
could just be

APR_DECLARE(const char *) apr_global_mutex_names(apr_global_mutex_t *mutex)
{
    return apr_proc_mutex_name(mutex->proc_mutex);
}

and

#define apr_global_mutex_names  apr_proc_mutex_names

--/--

Does anybody care?  (Otherwise I'll go with the second choice and
explain away the issue of the potential, non-selectable second mutex
in the doc.)

Mime
View raw message