[LTP] [PATCH] pthread_cancel_3-1: rewrite
Jan Stancek
jstancek@redhat.com
Mon Jun 4 13:50:57 CEST 2018
----- Original Message -----
> Jan Stancek <jstancek@redhat.com> wrote:
>
> >
> > > Maybe add:
> > > SAFE_PFUNC(pthread_mutex_unlock(&mutex));
> > > here too?
> >
> > There are no users at this point. Is there an issue having it locked at
> > exit?
> >
> >
> Not clear too. But after thinking over, maybe it's not a good idea to use
> pthread_mutex_lock() in this situation.
You're right, it's actually not defined according to POSIX:
http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_lock.html
>
> The reasons are:
> 1. to avoid dead lock, it's not suggest to lock a mutex twice in one thread
> 2. it's not suggest to lock mutex in thread_A but do unlock in thread_B
>
> So what about using semaphore:
Probably simpler than condition. Anyway, I'll drop my mutex fail in v2.
Thanks,
Jan
More information about the ltp
mailing list