[Linux][WTF] Use one global semaphore to notify thread suspend and resume completion
Created attachment 317109 [details] Patch
Comment on attachment 317109 [details] Patch ok, ready.
Comment on attachment 317109 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=317109&action=review > Source/WTF/wtf/ThreadingPthreads.cpp:89 > + Semaphore(unsigned initialValue) explicit? > Source/WTF/wtf/ThreadingPthreads.cpp:92 > + int sharedBetweenProcesses = 0; > + sem_init(&m_platformSemaphore, sharedBetweenProcesses, initialValue); Do we really need a local variable? or is it to document what that 0 means? > Source/WTF/wtf/ThreadingPthreads.cpp:202 > + globalSemaphoreForSuspendResume.construct(0); This is the only place it's constructed and we always pass 0 as initial value, right?
Comment on attachment 317109 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=317109&action=review >> Source/WTF/wtf/ThreadingPthreads.cpp:89 >> + Semaphore(unsigned initialValue) > > explicit? Yeah, nice. Fixed. >> Source/WTF/wtf/ThreadingPthreads.cpp:92 >> + sem_init(&m_platformSemaphore, sharedBetweenProcesses, initialValue); > > Do we really need a local variable? or is it to document what that 0 means? Yes, it is to document what that 0 means. >> Source/WTF/wtf/ThreadingPthreads.cpp:202 >> + globalSemaphoreForSuspendResume.construct(0); > > This is the only place it's constructed and we always pass 0 as initial value, right? Right. initializePlatformThreading() is called from initializeThreading(). And its content is guarded by call_once. Thus, this construction only happens once. And it should be done before using Threading. (initializeThreading() calls this function and constructs this semaphore.).
Committed r220201: <http://trac.webkit.org/changeset/220201>
<rdar://problem/33697497>