Changeset: b28a33b42a1d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b28a33b42a1d
Modified Files:
        gdk/gdk_system.h
Branch: default
Log Message:

Don't let coverity see lock owners, and don't do double work in case of lock 
contention.


diffs (23 lines):

diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -207,8 +207,10 @@ gdk_export void MT_thread_set_qry_ctx(Qr
 
 /* define this to keep track of which locks a thread has acquired */
 #ifndef NDEBUG                 /* normally only in debug builds */
+#ifndef __COVERITY__
 #define LOCK_OWNER 1
 #endif
+#endif
 
 #ifndef LOCK_OWNER
 #define MT_thread_add_mylock(l) ((void) 0)
@@ -469,7 +471,7 @@ typedef struct MT_Lock {
 #define MT_lock_set(l)                                 \
        do {                                            \
                _DBG_LOCK_COUNT_0(l);                   \
-               if (!MT_lock_try(l)) {                  \
+               if (pthread_mutex_trylock(&(l)->lock) { \
                        _DBG_LOCK_CONTENTION(l);        \
                        MT_thread_setlockwait(l);       \
                        pthread_mutex_lock(&(l)->lock); \
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to