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

Unified Diff: ppapi/native_client/src/shared/ppapi_proxy/plugin_threading.cc

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months 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
Index: ppapi/native_client/src/shared/ppapi_proxy/plugin_threading.cc
===================================================================
--- ppapi/native_client/src/shared/ppapi_proxy/plugin_threading.cc (revision 0)
+++ ppapi/native_client/src/shared/ppapi_proxy/plugin_threading.cc (revision 0)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2011 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <pthread.h>
+
+#include "native_client/src/include/nacl_macros.h"
+#include "native_client/src/shared/ppapi_proxy/ppruntime.h"
+
+
+/*
+ * This provides a default definition that is overridden in the IRT.
+ * TODO(mseaborn): Remove this when PPAPI is only supported via the IRT.
+ * See http://code.google.com/p/nativeclient/issues/detail?id=1691
+ */
+
+static int thread_create(uintptr_t *tid,
+ void (*func)(void *thread_argument),
+ void *thread_argument) {
+ /*
+ * We know that newlib and glibc use a small pthread_t type, so we
+ * do not need to wrap pthread_t values.
+ */
+ NACL_COMPILE_TIME_ASSERT(sizeof(pthread_t) == sizeof(uintptr_t));
+
+ return pthread_create((pthread_t *) tid, NULL,
+ (void *(*)(void *thread_argument)) func,
+ thread_argument);
+}
+
+static int thread_join(uintptr_t tid) {
+ return pthread_join((pthread_t) tid, NULL);
+}
+
+const static struct PP_ThreadFunctions thread_funcs = {
+ thread_create,
+ thread_join
+};
+
+void PpapiPluginRegisterDefaultThreadCreator() {
+ PpapiPluginRegisterThreadCreator(&thread_funcs);
+}

Powered by Google App Engine
This is Rietveld 408576698