Commit 9ce990d3 authored by Jens Gustedt's avatar Jens Gustedt
Browse files

the standard atomic op macros are not defined for double

parent ef36f17b
......@@ -11,6 +11,7 @@
/* particular purpose. */
/* */
#include "p99_threads.h"
#include "p99_atomic.h"
#include "p99_generic.h"
#include "p99_clib.h"
#include "p99_fifo.h"
......@@ -112,7 +113,12 @@ int real_task(atomic_intp* arg) {
ret = P99_GEN_MAX(count, 23);
cnd_signal(&cond);
mtx_unlock(&mut);
(void)atomic_fetch_add(&D, ret);
{
double d = atomic_load(&D);
while (!atomic_compare_exchange_weak(&D, &d, d+ret)) {
/* empty */
}
}
(void)atomic_fetch_add(&intp, 1);
int * point = atomic_fetch_add(arg, 1);
*point = ret;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment