mutex held in a thread which is cancelled stays busy

Erich Dollansky freebsd.ed.lists at sumeritec.com
Fri Aug 9 09:33:42 UTC 2019


Hi,

On Wed, 7 Aug 2019 13:26:31 -0400
Daniel Eischen <deischen at freebsd.org> wrote:

> > On Aug 7, 2019, at 6:25 AM, Erich Dollansky
> > <freebsd.ed.lists at sumeritec.com> wrote:
> > 
> >> Erich, are you getting EBUSY for pthread_mutex_lock() or is that
> >> only for pthread_mutex_trylock()?
> >>   
> > EBUSY is only returned when I call 'pthread_mutex_trylock'. The
> > other one just hangs.  
> 
> In this case, I think FreeBSD is behaving correctly.  I think perhaps
> the only problem is that the man page isn't reflecting the POSIX
> wording.

I only could go back to my test program now. I made the wrong
assumption that 'EOWNERDEAD' will be repeated. This error message comes
only one time. The caller has then to call 'pthread_mutex_consistent'
to correct the error. Having a program which misses one return value
leads to the problem I have had.

At least we learned with this that FreeBSD's version of pthreads is a
much more practical attempt than some others. 

Erich


More information about the freebsd-threads mailing list