[vlc-devel] [PATCH] android: threads support
Rémi Denis-Courmont
remi at remlab.net
Fri Oct 5 19:50:11 CEST 2012
Le vendredi 5 octobre 2012 15:00:14, Rafaël Carré a écrit :
> > I cannot see any warranty that lock and cond pointers are valid.
> >
> > Also, lock pointer seems useless in this business.
>
> """
> if predictable scheduling behavior is required, then that mutex shall
> be locked by the thread calling pthread_cond_broadcast()
> or pthread_cond_signal().
> """
Predictable scheduling refers to the predicate that is being watched for.
Here, you do not deal with the predicate.
> cond pointer is valid since the thread has not been joined yet, the
> storage is still allocated.
The storage of the cond pointer is valid because it is allocated with(in) the
thread handle. That says nothing of the life cycle and validity of the
condition variable pointed to by the cond pointer.
Also, even though the pointer storage is valid, its value is undefined since
since there are no barriers on the write side.
> If cond pointer is set, the thread is either waiting on the condition,
> or it just woke up.
If the thread has indeed woken up, what proves that it has not destroyed the
condition variable? Nothing. The behaviour is undefined and the code is wrong.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list