summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sandbox/src/broker_services.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sandbox/src/broker_services.cc b/sandbox/src/broker_services.cc
index 2c53a42..4382f7e 100644
--- a/sandbox/src/broker_services.cc
+++ b/sandbox/src/broker_services.cc
@@ -227,6 +227,13 @@ ResultCode BrokerServicesBase::SpawnTarget(const wchar_t* exe_path,
if (!policy)
return SBOX_ERROR_BAD_PARAMS;
+ // Even though the resources touched by SpawnTarget can be accessed in
+ // multiple threads, the method itself cannot be called from more than
+ // 1 thread. This is to protect the global variables used while setting up
+ // the child process.
+ static DWORD thread_id = ::GetCurrentThreadId();
+ DCHECK(thread_id == ::GetCurrentThreadId());
+
AutoLock lock(&lock_);
// This downcast is safe as long as we control CreatePolicy()