Changeset: 5ff46639cd9a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5ff46639cd9a
Modified Files:
common/utils/matomic.h
gdk/gdk_utils.c
Branch: subquery
Log Message:
merged with default
diffs (58 lines):
diff --git a/common/utils/matomic.h b/common/utils/matomic.h
--- a/common/utils/matomic.h
+++ b/common/utils/matomic.h
@@ -48,7 +48,7 @@
* These two operations are only defined on variables of type
* ATOMIC_FLAG, and the only values defined for such a variable are
* "false" and "true". The variable can be statically initialized
- * using the ATOMIC_FLAG_INIT macro.
+ * to "false" using the ATOMIC_FLAG_INIT macro.
*/
#ifndef _MATOMIC_H_
@@ -263,6 +263,7 @@ typedef volatile int ATOMIC_TYPE;
typedef void *volatile ATOMIC_PTR_TYPE;
#define ATOMIC_PTR_INIT(var, val) (*(var) = (val))
+#define ATOMIC_PTR_VAR_INIT(val) (val)
#define ATOMIC_PTR_DESTROY(var) ((void) 0)
#define ATOMIC_PTR_GET(var) __atomic_load_n(var, __ATOMIC_SEQ_CST)
#define ATOMIC_PTR_SET(var, val) __atomic_store_n(var, (val),
__ATOMIC_SEQ_CST)
@@ -391,6 +392,7 @@ typedef struct {
void *val;
pthread_mutex_t lck;
} ATOMIC_PTR_TYPE;
+#define ATOMIC_PTR_VAR_INIT(v) { .val = (v), .lck = PTHREAD_MUTEX_INITIALIZER }
static inline void
ATOMIC_PTR_INIT(ATOMIC_PTR_TYPE *var, void *val)
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -717,7 +717,7 @@ GDKprepareExit(void)
/* we're saved from the ABA problem in this code because it is
* only executed by one thread */
while ((st = ATOMIC_PTR_GET(&serverthread)) != NULL) {
- while (!ATOMIC_PTR_CAS(&serverthread, &st, st->next))
+ while (!ATOMIC_PTR_CAS(&serverthread, &((void *) {st}),
st->next))
;
MT_join_thread(st->pid);
GDKfree(st);
@@ -736,7 +736,7 @@ GDKregister(MT_Id pid)
return;
st->pid = pid;
st->next = ATOMIC_PTR_GET(&serverthread);
- while (!ATOMIC_PTR_CAS(&serverthread, &st->next, st))
+ while (!ATOMIC_PTR_CAS(&serverthread, &((void *) {st->next}), st))
;
}
@@ -760,7 +760,7 @@ GDKreset(int status)
/* we're saved from the ABA problem in this code because it is
* only executed by one thread */
while ((st = ATOMIC_PTR_GET(&serverthread)) != NULL) {
- while (!ATOMIC_PTR_CAS(&serverthread, &st, st->next))
+ while (!ATOMIC_PTR_CAS(&serverthread, &((void *) {st}),
st->next))
;
MT_join_thread(st->pid);
GDKfree(st);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list