You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Marc Dugger <md...@austin.rr.com> on 2002/11/22 15:29:45 UTC

mutex lock

I'm attempting to execute some of the "test" code found in the JXTA project
which utilizes Apache APR.  Several of the test applications are "hanging"
at the same point and, because my C++ is so weak, I have no idea why.  The
code appears to pass the pointer of the same object into the function,
apr_thread_mutex_lock(apr_thread_mutex_t *mutex) of thread_mutex.c.
However, on the second function call, the thread blocks when calling
EnterCriticalSection() and never returns.  Here's the code in
jxta_discovery_service_ref.c:

if ( discovery->cm_on ) {
		jxta_cm_create_folder(discovery->cm, (char *) dirname[DISC_PEER],
p_keywords);
		jxta_cm_create_folder(discovery->cm, (char *) dirname[DISC_GROUP],
g_keywords); <-- function called.
		jxta_cm_create_folder(discovery->cm, (char *) dirname[DISC_ADV],
a_keywords);
	}

...which invokes jxta_cm.c:

jxta_cm_create_folder(Jxta_cm *self, char * folder_name, const char *keys[])
{
    const char** p;
    Jxta_status status;
    char* full_name;
    Folder* folder;

    apr_thread_mutex_lock (self->mutex);  <-- function called.

	[...code excluded...]

    apr_thread_mutex_unlock (self->mutex);

    return JXTA_SUCCESS;
}

...which invokes thread_mutex.c of APR:

APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex)
{
    if (mutex->type == thread_mutex_critical_section) {
        EnterCriticalSection(&mutex->section);  <-- blocks here!!!
    }


I am using the latest CVS code from both APR and Jxta.  Can anyone provide
some insight on this?  Thanks in advance.

-md