pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: problem with electric



Ulrich Etile wrote:
> Le Thu, 14 Dec 2006 12:09:46 -0600 (CST),
> > > electric: Error detected by libpthread: Unlocking unlocked mutex.
> > > Detected by file
> > > "/home/builds/ab/netbsd-3-1-RELEASE/src/lib/libpthread/pthread_mutex.c",
> > > line 363, function "pthread_mutex_unlock". See pthread(3) for
> > > information. Abort

> /*
>  * Routine that unlocks mutual-exclusion object "vmutex".
>  */
> void emutexunlock(void *vmutex)
> {
> #ifdef HAVE_PTHREAD
>       pthread_mutex_t *mutex;
> 
>       mutex = (pthread_mutex_t *)vmutex;
>       pthread_mutex_unlock(mutex);
> #else
>       mutex_t *mutexid;
> 
>       mutexid = (mutex_t *)vmutex;
>       mutex_unlock(mutexid);
> #endif
> }
> 
> <<<<<
> 
> Apparently, if I remove function pthread_mutex_unlock() : it runs. 
> But I don't think that is good to remove the function
> pthread_unlock_mutex.

The problem is not this function itself but how it's used. I'm no
threadpert but I could think of a hack that is

                pthread_mutex_trylock(mutex));
                pthread_mutex_unlock(mutex);

-- 
Christian



Home | Main Index | Thread Index | Old Index