diff options
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/os/os0thread.c | 2 | ||||
-rw-r--r-- | innobase/sync/sync0sync.c | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c index 2664d574122..c1519ac58e4 100644 --- a/innobase/os/os0thread.c +++ b/innobase/os/os0thread.c @@ -122,7 +122,7 @@ os_thread_yield(void) #ifdef __WIN__ Sleep(0); #else - os_thread_sleep(0); + pthread_yield(); #endif } diff --git a/innobase/sync/sync0sync.c b/innobase/sync/sync0sync.c index b98b22dd90b..a27dc74c2fb 100644 --- a/innobase/sync/sync0sync.c +++ b/innobase/sync/sync0sync.c @@ -366,6 +366,15 @@ spin_loop: return; } + + /* We may end up with a situation where lock_word is + 0 but the OS fast mutex is still reserved. On FreeBSD + the OS does not seem to schedule a thread which is constantly + calling pthread_mutex_trylock (in mutex_test_and_set + implementation). Then we could end up spinning here indefinitely. + The following 'i++' stops this infinite spin. */ + + i++; if (i < SYNC_SPIN_ROUNDS) { |