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

Unified Diff: src/trusted/service_runtime/win/thread_suspension.c

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
« no previous file with comments | « src/trusted/service_runtime/service_runtime.gyp ('k') | tests/thread_suspension/nacl.scons » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/win/thread_suspension.c
diff --git a/src/trusted/service_runtime/win/thread_suspension.c b/src/trusted/service_runtime/win/thread_suspension.c
index 9b7f268a1daad23d570abb7fd31e6b84f066b0f8..ac51a9148d8a9f0cbe86402b47570372a2da0163 100644
--- a/src/trusted/service_runtime/win/thread_suspension.c
+++ b/src/trusted/service_runtime/win/thread_suspension.c
@@ -12,6 +12,21 @@
#include "native_client/src/trusted/service_runtime/sel_ldr.h"
+void NaClAppThreadSetSuspendState(struct NaClAppThread *natp,
+ enum NaClSuspendState old_state,
+ enum NaClSuspendState new_state) {
+ NaClXMutexLock(&natp->mu);
+ while ((natp->suspend_state & NACL_APP_THREAD_SUSPENDING) != 0) {
+ /*
+ * We are being suspended, but SuspendThread() has not taken effect yet.
+ */
+ NaClXCondVarWait(&natp->cv, &natp->mu);
+ }
+ DCHECK(natp->suspend_state == old_state);
+ natp->suspend_state = new_state;
+ NaClXMutexUnlock(&natp->mu);
+}
+
void NaClUntrustedThreadSuspend(struct NaClAppThread *natp) {
enum NaClSuspendState old_state;
« no previous file with comments | « src/trusted/service_runtime/service_runtime.gyp ('k') | tests/thread_suspension/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698