Changeset: f878a3c89d63 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f878a3c89d63 Modified Files: gdk/gdk_system.h Branch: Apr2019 Log Message:
Reintroduce busy waiting for a lock: it makes a huge difference on Windows. On Windows the shortest time we can sleep is one millisecond which is too long. diffs (21 lines): diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h --- a/gdk/gdk_system.h +++ b/gdk/gdk_system.h @@ -438,11 +438,15 @@ typedef struct MT_Lock { _DBG_LOCK_COUNT_0(l); \ if (!MT_lock_try(l)) { \ /* we didn't get the lock */ \ + int _spincnt = 0; \ _DBG_LOCK_CONTENTION(l); \ MT_thread_setlockwait(l); \ do { \ - _DBG_LOCK_SLEEP(l); \ - MT_sleep_ms(1); \ + if (++_spincnt == 2048) { \ + _spincnt = 0; \ + _DBG_LOCK_SLEEP(l); \ + MT_sleep_ms(1); \ + } \ } while (!MT_lock_try(l)); \ MT_thread_setlockwait(NULL); \ } \ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list