| Index: src/platform-openbsd.cc
|
| diff --git a/src/platform-openbsd.cc b/src/platform-openbsd.cc
|
| index 6a06e3e53669b66680d718d16a04e548af6e6aa3..2b2d5308eb1cbceb8cd42f13999dae02dece5688 100644
|
| --- a/src/platform-openbsd.cc
|
| +++ b/src/platform-openbsd.cc
|
| @@ -100,18 +100,8 @@ static void* GetRandomMmapAddr() {
|
| }
|
|
|
|
|
| -void OS::SetUp() {
|
| - // Seed the random number generator. We preserve microsecond resolution.
|
| - uint64_t seed = Ticks() ^ (getpid() << 16);
|
| - srandom(static_cast<unsigned int>(seed));
|
| - limit_mutex = CreateMutex();
|
| -}
|
| -
|
| -
|
| void OS::PostSetUp() {
|
| - // Math functions depend on CPU features therefore they are initialized after
|
| - // CPU.
|
| - MathSetup();
|
| + POSIXPostSetUp();
|
| }
|
|
|
|
|
| @@ -803,6 +793,12 @@ class SignalSender : public Thread {
|
| vm_tgid_(getpid()),
|
| interval_(interval) {}
|
|
|
| + static void SetUp() {
|
| + if (!mutex_) {
|
| + mutex_ = OS::CreateMutex();
|
| + }
|
| + }
|
| +
|
| static void InstallSignalHandler() {
|
| struct sigaction sa;
|
| sa.sa_sigaction = ProfilerSignalHandler;
|
| @@ -820,7 +816,7 @@ class SignalSender : public Thread {
|
| }
|
|
|
| static void AddActiveSampler(Sampler* sampler) {
|
| - ScopedLock lock(mutex_.Pointer());
|
| + ScopedLock lock(mutex_);
|
| SamplerRegistry::AddActiveSampler(sampler);
|
| if (instance_ == NULL) {
|
| // Start a thread that will send SIGPROF signal to VM threads,
|
| @@ -833,7 +829,7 @@ class SignalSender : public Thread {
|
| }
|
|
|
| static void RemoveActiveSampler(Sampler* sampler) {
|
| - ScopedLock lock(mutex_.Pointer());
|
| + ScopedLock lock(mutex_);
|
| SamplerRegistry::RemoveActiveSampler(sampler);
|
| if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
|
| RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_);
|
| @@ -927,7 +923,7 @@ class SignalSender : public Thread {
|
| RuntimeProfilerRateLimiter rate_limiter_;
|
|
|
| // Protects the process wide state below.
|
| - static LazyMutex mutex_;
|
| + static Mutex* mutex_;
|
| static SignalSender* instance_;
|
| static bool signal_handler_installed_;
|
| static struct sigaction old_signal_handler_;
|
| @@ -937,12 +933,21 @@ class SignalSender : public Thread {
|
| };
|
|
|
|
|
| -LazyMutex SignalSender::mutex_ = LAZY_MUTEX_INITIALIZER;
|
| +Mutex* SignalSender::mutex_ = NULL;
|
| SignalSender* SignalSender::instance_ = NULL;
|
| struct sigaction SignalSender::old_signal_handler_;
|
| bool SignalSender::signal_handler_installed_ = false;
|
|
|
|
|
| +void OS::SetUp() {
|
| + // Seed the random number generator. We preserve microsecond resolution.
|
| + uint64_t seed = Ticks() ^ (getpid() << 16);
|
| + srandom(static_cast<unsigned int>(seed));
|
| + limit_mutex = CreateMutex();
|
| + SignalSender::SetUp();
|
| +}
|
| +
|
| +
|
| Sampler::Sampler(Isolate* isolate, int interval)
|
| : isolate_(isolate),
|
| interval_(interval),
|
|
|