Chromium Code Reviews| 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) { |
|
bradn
2012/05/18 19:56:35
nix !=0
Mark Seaborn
2012/05/21 15:03:57
See other reply.
|
| + /* |
| + * 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; |