diff --git a/deps/v8/src/platform-freebsd.cc b/deps/v8/src/platform-freebsd.cc index 511759c485e2..5c90c6bdae85 100644 --- a/deps/v8/src/platform-freebsd.cc +++ b/deps/v8/src/platform-freebsd.cc @@ -539,11 +539,6 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) { } -void Thread::YieldCPU() { - sched_yield(); -} - - class FreeBSDMutex : public Mutex { public: FreeBSDMutex() { diff --git a/deps/v8/src/platform-linux.cc b/deps/v8/src/platform-linux.cc index beb2ccee297f..3d6b3044e7bc 100644 --- a/deps/v8/src/platform-linux.cc +++ b/deps/v8/src/platform-linux.cc @@ -812,11 +812,6 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) { } -void Thread::YieldCPU() { - sched_yield(); -} - - class LinuxMutex : public Mutex { public: LinuxMutex() { diff --git a/deps/v8/src/platform-macos.cc b/deps/v8/src/platform-macos.cc index a216f6e4cacd..e54e3e4a4216 100644 --- a/deps/v8/src/platform-macos.cc +++ b/deps/v8/src/platform-macos.cc @@ -640,11 +640,6 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) { } -void Thread::YieldCPU() { - sched_yield(); -} - - class MacOSMutex : public Mutex { public: MacOSMutex() { diff --git a/deps/v8/src/platform-openbsd.cc b/deps/v8/src/platform-openbsd.cc index 408d4dc0f848..72167de9202d 100644 --- a/deps/v8/src/platform-openbsd.cc +++ b/deps/v8/src/platform-openbsd.cc @@ -593,11 +593,6 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) { } -void Thread::YieldCPU() { - sched_yield(); -} - - class OpenBSDMutex : public Mutex { public: OpenBSDMutex() { diff --git a/deps/v8/src/platform-posix.cc b/deps/v8/src/platform-posix.cc index 5c3529d4458c..8aecd560e908 100644 --- a/deps/v8/src/platform-posix.cc +++ b/deps/v8/src/platform-posix.cc @@ -392,6 +392,12 @@ void OS::StrNCpy(Vector dest, const char* src, size_t n) { } +void Thread::YieldCPU() { + const timespec delay = { 0, 1 }; + nanosleep(&delay, NULL); +} + + // ---------------------------------------------------------------------------- // POSIX socket support. // diff --git a/deps/v8/src/platform-solaris.cc b/deps/v8/src/platform-solaris.cc index 07718fe50b99..4e95ecc6a48b 100644 --- a/deps/v8/src/platform-solaris.cc +++ b/deps/v8/src/platform-solaris.cc @@ -527,11 +527,6 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* value) { } -void Thread::YieldCPU() { - sched_yield(); -} - - class SolarisMutex : public Mutex { public: SolarisMutex() { diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp index 71cf36649ada..c304925908ac 100644 --- a/deps/v8/tools/gyp/v8.gyp +++ b/deps/v8/tools/gyp/v8.gyp @@ -715,7 +715,7 @@ ['OS=="solaris"', { 'link_settings': { 'libraries': [ - '-lsocket -lnsl', + '-lsocket -lnsl -lrt', ]}, 'sources': [ '../../src/platform-solaris.cc',