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

Unified Diff: src/trusted/service_runtime/nacl_app_thread.h

Issue 10392005: Thread suspension: Implement for Linux (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Comment about docs Created 8 years, 7 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: src/trusted/service_runtime/nacl_app_thread.h
diff --git a/src/trusted/service_runtime/nacl_app_thread.h b/src/trusted/service_runtime/nacl_app_thread.h
index cd823cfd3b86c359b5d511298ff38a16b2ba4ca8..f7cce0e1fa4f29568ffd9ac2702113ad43b5a327 100644
--- a/src/trusted/service_runtime/nacl_app_thread.h
+++ b/src/trusted/service_runtime/nacl_app_thread.h
@@ -11,6 +11,7 @@
#ifndef NATIVE_CLIENT_SERVICE_RUNTIME_NACL_APP_THREAD_H__
#define NATIVE_CLIENT_SERVICE_RUNTIME_NACL_APP_THREAD_H__ 1
+#include "native_client/src/include/atomic_ops.h"
#include "native_client/src/shared/platform/nacl_sync.h"
#include "native_client/src/shared/platform/nacl_threads.h"
#include "native_client/src/trusted/service_runtime/nacl_signal.h"
@@ -26,18 +27,30 @@ struct NaClApp;
* between NACL_APP_THREAD_TRUSTED and NACL_APP_THREAD_UNTRUSTED using
* NaClAppThreadSetSuspendState().
*
- * Another thread may change this from:
+ * A controlling thread may change this from:
* NACL_APP_THREAD_UNTRUSTED
* -> NACL_APP_THREAD_UNTRUSTED | NACL_APP_THREAD_SUSPENDING
* or
* NACL_APP_THREAD_TRUSTED
* -> NACL_APP_THREAD_TRUSTED | NACL_APP_THREAD_SUSPENDING
* and back again.
+ *
+ * Additionally, on Linux, the signal handler in the thread being
+ * suspended will change suspend_state from:
+ * NACL_APP_THREAD_UNTRUSTED | NACL_APP_THREAD_SUSPENDING
+ * -> (NACL_APP_THREAD_UNTRUSTED | NACL_APP_THREAD_SUSPENDING
+ * | NACL_APP_THREAD_SUSPENDED)
+ * The controlling thread will later change suspend_thread back to:
+ * NACL_APP_THREAD_UNTRUSTED
+ * This tells the signal handler to resume execution.
*/
enum NaClSuspendState {
NACL_APP_THREAD_UNTRUSTED = 1,
NACL_APP_THREAD_TRUSTED = 2,
NACL_APP_THREAD_SUSPENDING = 4
+#if NACL_LINUX
+ , NACL_APP_THREAD_SUSPENDED = 8
+#endif
};
/*
@@ -72,14 +85,7 @@ struct NaClAppThread {
struct NaClThread thread; /* low level thread representation */
- /*
- * Thread suspension is currently only needed and implemented for
- * Windows, for preventing race conditions when opening up holes in
- * untrusted address space during mmap/munmap.
- */
-#if NACL_WINDOWS
- enum NaClSuspendState suspend_state;
-#endif
+ Atomic32 suspend_state; /* enum NaClSuspendState */
struct NaClThreadContext user;
struct NaClThreadContext sys;
« no previous file with comments | « src/trusted/service_runtime/linux/thread_suspension.c ('k') | src/trusted/service_runtime/nacl_app_thread.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698