RESOLVED FIXED 175124
[Linux][WTF] Use one global semaphore to notify thread suspend and resume completion
https://bugs.webkit.org/show_bug.cgi?id=175124
Summary [Linux][WTF] Use one global semaphore to notify thread suspend and resume com...
Yusuke Suzuki
Reported 2017-08-03 03:46:21 PDT
[Linux][WTF] Use one global semaphore to notify thread suspend and resume completion
Attachments
Patch (8.02 KB, patch)
2017-08-03 03:50 PDT, Yusuke Suzuki
cgarcia: review+
Yusuke Suzuki
Comment 1 2017-08-03 03:50:42 PDT
Yusuke Suzuki
Comment 2 2017-08-03 03:53:12 PDT
Comment on attachment 317109 [details] Patch ok, ready.
Carlos Garcia Campos
Comment 3 2017-08-03 04:10:23 PDT
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?
Yusuke Suzuki
Comment 4 2017-08-03 04:13:20 PDT
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.).
Yusuke Suzuki
Comment 5 2017-08-03 04:17:49 PDT
Radar WebKit Bug Importer
Comment 6 2017-08-03 04:18:23 PDT
Note You need to log in before you can comment on or make changes to this bug.