Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: base/platform_thread_posix.cc

Issue 5206005: Revert 66719 - Reland r65996. Disallows Singletons on non-joinable thread.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop_proxy_impl.cc ('k') | base/platform_thread_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/platform_thread_posix.cc
===================================================================
--- base/platform_thread_posix.cc (revision 66790)
+++ base/platform_thread_posix.cc (working copy)
@@ -7,11 +7,6 @@
#include <errno.h>
#include <sched.h>
-#include "base/logging.h"
-#include "base/safe_strerror_posix.h"
-#include "base/scoped_ptr.h"
-#include "base/thread_restrictions.h"
-
#if defined(OS_MACOSX)
#include <mach/mach.h>
#include <sys/resource.h>
@@ -29,27 +24,18 @@
#include <sys/nacl_syscalls.h>
#endif
+#include "base/logging.h"
+#include "base/safe_strerror_posix.h"
+
#if defined(OS_MACOSX)
namespace base {
void InitThreading();
} // namespace base
#endif
-namespace {
-
-struct ThreadParams {
- PlatformThread::Delegate* delegate;
- bool joinable;
-};
-
-} // namespace
-
-static void* ThreadFunc(void* params) {
- ThreadParams* thread_params = static_cast<ThreadParams*>(params);
- PlatformThread::Delegate* delegate = thread_params->delegate;
- if (!thread_params->joinable)
- base::ThreadRestrictions::SetSingletonAllowed(false);
- delete thread_params;
+static void* ThreadFunc(void* closure) {
+ PlatformThread::Delegate* delegate =
+ static_cast<PlatformThread::Delegate*>(closure);
delegate->ThreadMain();
return NULL;
}
@@ -188,14 +174,9 @@
if (stack_size > 0)
pthread_attr_setstacksize(&attributes, stack_size);
- ThreadParams* params = new ThreadParams;
- params->delegate = delegate;
- params->joinable = joinable;
- success = !pthread_create(thread_handle, &attributes, ThreadFunc, params);
+ success = !pthread_create(thread_handle, &attributes, ThreadFunc, delegate);
pthread_attr_destroy(&attributes);
- if (!success)
- delete params;
return success;
}
« no previous file with comments | « base/message_loop_proxy_impl.cc ('k') | base/platform_thread_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698