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

Unified Diff: src/untrusted/init/thread.h

Issue 25147002: nacl_init Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 3 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
« no previous file with comments | « src/untrusted/init/simple_service.cc ('k') | src/untrusted/init/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/untrusted/init/thread.h
diff --git a/src/untrusted/init/thread.h b/src/untrusted/init/thread.h
new file mode 100644
index 0000000000000000000000000000000000000000..8dc9a0033edb321ea5bc08b015842a32e8ad6cbe
--- /dev/null
+++ b/src/untrusted/init/thread.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 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.
+
+#ifndef NATIVE_CLIENT_SRC_UNTRUSTED_INIT_KERNEL_SERVICE_H_
+#define NATIVE_CLIENT_SRC_UNTRUSTED_INIT_KERNEL_SERVICE_H_
+
+namespace nacl {
+
+class Thread;
+
+typedef void *(*ThreadStartFunction)(
+ Thread *interface);
+
+typedef int (*ThreadFactoryFunction)(
+ void *factory_data,
+ ThreadStartFunction start_routine,
+ void *thread_data,
+ Thread **out_new_thread);
+
+class Thread : public RefCountBase {
+ public:
+ virtual int Start();
+ virtual void LaunchCallback() = 0;
+ virtual void Exit(void *thread_return);
+
+ protected:
+ Thread(ThreadFactoryFunction factory,
+ void *factory_data,
+ ThreadStartFunction start_routine,
+ void *thread_data);
+ virtual ~Thread();
+
+ private:
+ ThreadFactoryFunction factory_;
+ void *factory_data_;
+
+ // Whether the thread was successfully started.
+ bool started_;
+
+ // Whether the thread is in the middle of stopping.
+ bool stopping_;
+
+ // Used to pass data to ThreadMain.
+ ThreadStartFunction start_routine_;
+ void *startup_data;
+
+ // The threads's handle.
+ pthread_t thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(Thread);
+};
+
+} // namespace nacl
+
+#endif
« no previous file with comments | « src/untrusted/init/simple_service.cc ('k') | src/untrusted/init/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698