Title: [174719] trunk/Source/WebKit2
Revision
174719
Author
[email protected]
Date
2014-10-14 17:53:11 -0700 (Tue, 14 Oct 2014)

Log Message

[WK2][EFL] Fix the problem that threads created by a DispatchQueueEfl are not destroyed
even after the DispatchQueueEfl has been destructed
https://bugs.webkit.org/show_bug.cgi?id=137195

Patch by Joonghun Park <[email protected]> on 2014-10-14
Reviewed by Gyuyoung Kim.

Linux and Unix System's pthreads are created in joinable state by default.
If threads aren't destructed explicitly, it will be still live
until process which created the thread is dead.
Besides it may cause out of capacity range of thread creation in a process.
It is one of hidden defects.
This patch calls detachThread() to detach thread immediately after it is created.
So the thread can be destroyed as soon as the thread's ThreadContext::function()
returns.

* Platform/efl/DispatchQueueEfl.cpp:
(DispatchQueue::ThreadContext::start):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (174718 => 174719)


--- trunk/Source/WebKit2/ChangeLog	2014-10-15 00:50:56 UTC (rev 174718)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-15 00:53:11 UTC (rev 174719)
@@ -1,3 +1,23 @@
+2014-10-14  Joonghun Park  <[email protected]>
+
+        [WK2][EFL] Fix the problem that threads created by a DispatchQueueEfl are not destroyed
+        even after the DispatchQueueEfl has been destructed
+        https://bugs.webkit.org/show_bug.cgi?id=137195
+
+        Reviewed by Gyuyoung Kim.
+
+        Linux and Unix System's pthreads are created in joinable state by default.
+        If threads aren't destructed explicitly, it will be still live
+        until process which created the thread is dead.
+        Besides it may cause out of capacity range of thread creation in a process.
+        It is one of hidden defects.
+        This patch calls detachThread() to detach thread immediately after it is created.
+        So the thread can be destroyed as soon as the thread's ThreadContext::function()
+        returns.
+
+        * Platform/efl/DispatchQueueEfl.cpp:
+        (DispatchQueue::ThreadContext::start):
+
 2014-10-14  Chris Dumez  <[email protected]>
 
         Use is<>() / downcast<>() for PlatformCAAnimation subclasses

Modified: trunk/Source/WebKit2/Platform/efl/DispatchQueueEfl.cpp (174718 => 174719)


--- trunk/Source/WebKit2/Platform/efl/DispatchQueueEfl.cpp	2014-10-15 00:50:56 UTC (rev 174718)
+++ trunk/Source/WebKit2/Platform/efl/DispatchQueueEfl.cpp	2014-10-15 00:53:11 UTC (rev 174719)
@@ -42,7 +42,7 @@
     static void start(const char* name, PassRefPtr<DispatchQueue> dispatchQueue)
     {
         // The DispatchQueueThreadContext instance will be passed to the thread function and deleted in it.
-        createThread(reinterpret_cast<WTF::ThreadFunction>(&ThreadContext::function), new ThreadContext(dispatchQueue), name);
+        detachThread(createThread(reinterpret_cast<WTF::ThreadFunction>(&ThreadContext::function), new ThreadContext(dispatchQueue), name));
     }
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to