Changeset: 37e79e807878 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=37e79e807878 Modified Files: gdk/gdk_bbp.c Branch: Jan2014 Log Message:
Fix data race on stamp variable. diffs (35 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -120,17 +120,20 @@ static int BBPbackup(BAT *b, bit subcomm #define BBPnamecheck(s) (BBPtmpcheck(s) ? ((s)[3] == '_' ? strtol((s) + 4, NULL, 8) : -strtol((s) + 5, NULL, 8)) : 0) -static int stamp = 0; +#ifdef ATOMIC_LOCK +static MT_Lock stampLock MT_LOCK_INITIALIZER("stampLock"); +#endif +static volatile ATOMIC_TYPE stamp = 0; static inline int BBPstamp(void) { - return ++stamp; + return (int) ATOMIC_INC(stamp, stampLock, "BBPstamp"); } static void BBPsetstamp(int newstamp) { - stamp = newstamp; + ATOMIC_SET(stamp, newstamp, stampLock, "BBPsetstamp"); } @@ -973,6 +976,7 @@ BBPinit(void) #ifdef NEED_MT_LOCK_INIT MT_lock_init(&GDKunloadLock, "GDKunloadLock"); + ATOMIC_INIT(stampLock, "stampLock"); #endif /* first move everything from SUBDIR to BAKDIR (its parent) */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list