summaryrefslogtreecommitdiff
path: root/src/stdatomic/atomic_compare_exchange_weak_explicit.c
blob: 03215147d353612a3285da155466c8fc9230f297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#if 0

#include <stdatomic.h>
#include <stdbool.h>

_Bool atomic_compare_exchange_weak_explicit(volatile __TYPE *object, __BASE *expected, __BASE desired, memory_order failure)
{
	switch (failure) {
	case memory_order_release:
	case memory_order_acq_rel:
		abort();
		break;

	default:
		break;
	}

	if (memcmp(object, expected, sizeof(*object)) == 0) {
		memcpy(object, &desired, sizeof(*object));
		return true;
	}

	memcpy(expected, object, sizeof(*object));
	return false;
}


#endif

/*
STDC(201112)
*/