mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Add IsStarted() method to GlobalForkClient.
PiperOrigin-RevId: 351170872 Change-Id: I5544eb27962606a562ce79b97d508f841ec0dc56
This commit is contained in:
parent
3d737e3830
commit
b61b2a37b7
|
@ -35,6 +35,7 @@
|
|||
#include "absl/strings/str_join.h"
|
||||
#include "absl/strings/str_split.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/synchronization/mutex.h"
|
||||
#include "sandboxed_api/embed_file.h"
|
||||
#include "sandboxed_api/sandbox2/comms.h"
|
||||
#include "sandboxed_api/sandbox2/fork_client.h"
|
||||
|
@ -206,4 +207,9 @@ pid_t GlobalForkClient::GetPid() {
|
|||
EnsureStartedLocked(GlobalForkserverStartMode::kOnDemand);
|
||||
return instance_->fork_client_.pid();
|
||||
}
|
||||
|
||||
bool GlobalForkClient::IsStarted() {
|
||||
absl::ReaderMutexLock lock(&instance_mutex_);
|
||||
return instance_ != nullptr;
|
||||
}
|
||||
} // namespace sandbox2
|
||||
|
|
|
@ -54,6 +54,7 @@ class GlobalForkClient {
|
|||
EnsureStarted(GlobalForkserverStartMode::kOnDemand);
|
||||
}
|
||||
static void Shutdown() ABSL_LOCKS_EXCLUDED(instance_mutex_);
|
||||
static bool IsStarted() ABSL_LOCKS_EXCLUDED(instance_mutex_);
|
||||
|
||||
private:
|
||||
friend void StartGlobalForkserverFromLibCtor();
|
||||
|
|
Loading…
Reference in New Issue
Block a user