[Webkit-unassigned] [Bug 39893] Explicitly use PTHREAD_MUTEX_NORMAL to create pthread mutex

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 31 12:59:35 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=39893





--- Comment #17 from Yong Li <yong.li.webkit at gmail.com>  2010-05-31 12:59:33 PST ---
(In reply to comment #15)
> (In reply to comment #13)
> > (In reply to comment #12)
> > > > +    // Make sure it's not the same value as PTHREAD_MUTEX_INITIALIZER.
> > > This comment makes no sense. Why is it important to make sure that something is not the same value as PTHREAD_MUTEX_INITIALIZER? How is that relevant at all?
> > 
> > pthread_mutex_init and pthread_mutex_destroy are not supposed to be called on PTHREAD_MUTEX_INITIALIZER. I cannot find any scription that defines the behavior. So I assume the behavior is undefined, and up to implementation.
> 
> I think you're misunderstanding this. I read over the various documentation, and yes, it's true that you should not use both PTHREAD_MUTEXT_INITIALIZER and pthread_mutex_init on the same mutex, but that does not mean that you have to pre-initialize the mutex before calling pthread_mutex_init. It just means that it's a programming mistake to both use PTHREAD_MUTEXT_INITIALIZER and pthread_mutex_init.

If we don't initialize the mutex, what if the mutex just happens to be the same value as PTHREAD_MUTEXT_INITIALIZER? Although the chance if very small.

OK, I'll remove that code anyway.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list