[vlc-devel] commit: objects: Call vlc_object_join()automatically from vlc_object_destructor() if needed. (Pierred'Herbemont )
pdherbemont at free.fr
Tue Mar 25 18:16:26 CET 2008
On Mar 25, 2008, at 3:15 PM, Remi Denis-Courmont wrote:
> On Tue, 25 Mar 2008 11:02:21 +0100, Pierre d'Herbemont
> <pdherbemont at free.fr> wrote:
>>> If a thread calls vlc_object_release() to destroy itself, there is
>>> obvious deadlock, and vlc_thread_join() fails loudly.
>> pthread_join() should not dead lock and return EDEADLK. On Windows, I
>> don't know.
> EDEADLK is a MAY fail error, not a SHALL fail error. There is no
> for pthread implementations to handle this properly.
Can we agree that sane pthread implementation do that? (like
vlc_assert_locked() and such).
> Besides, calling
> pthread_join() multiple times against the same thread is explicitly
Where would we do that? (vlc_thread_join set b_thread to false).
I could agree to revert but I think we have to find a better solution.
The threaded vlc_object_t refcounting depends on that. (Else you end
up with mem corruption in vlc_object_destroy(), if a thread is running).
The other solution would be to simply have a buffer function between
the pthread_create() and the object's run loop that make sure we can
effectively tell if the run loop has been properly killed.
What do you think?
More information about the vlc-devel