Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102170259
D36078.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36078.diff
View Options
diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h
--- a/sys/sys/atomic_common.h
+++ b/sys/sys/atomic_common.h
@@ -39,6 +39,10 @@
#include <sys/cdefs.h>
#include <sys/types.h>
+#define __atomic_load_bool_relaxed(p) (*(volatile _Bool *)(p))
+#define __atomic_store_bool_relaxed(p, v) \
+ (*(volatile _Bool *)(p) = (_Bool)(v))
+
#define __atomic_load_char_relaxed(p) (*(volatile u_char *)(p))
#define __atomic_load_short_relaxed(p) (*(volatile u_short *)(p))
#define __atomic_load_int_relaxed(p) (*(volatile u_int *)(p))
@@ -70,6 +74,11 @@
*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
__has_extension(c_generic_selections)
+#define atomic_load_bool(p) \
+ _Generic(*(p), _Bool: __atomic_load_bool_relaxed(p))
+#define atomic_store_bool(p, v) \
+ _Generic(*(p), _Bool: __atomic_store_bool_relaxed(p, v))
+
#define __atomic_load_generic(p, t, ut, n) \
_Generic(*(p), \
t: __atomic_load_ ## n ## _relaxed(p), ut: __atomic_load_ ## n ## _relaxed(p))
@@ -77,6 +86,8 @@
_Generic(*(p), \
t: __atomic_store_ ## n ## _relaxed(p, v), ut: __atomic_store_ ## n ## _relaxed(p, v))
#else
+#define atomic_load_bool(p) __atomic_load_bool_relaxed(p)
+#define atomic_store_bool(p, v) __atomic_store_bool_relaxed(p, v)
#define __atomic_load_generic(p, t, ut, n) __atomic_load_ ## n ## _relaxed(p)
#define __atomic_store_generic(p, v, t, ut, n) __atomic_store_ ## n ## _relaxed(p, v)
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 11:37 AM (21 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14558793
Default Alt Text
D36078.diff (1 KB)
Attached To
Mode
D36078: atomic: Add atomic_load/store_bool()
Attached
Detach File
Event Timeline
Log In to Comment