Cleanup: remove leftover manual pthread detection
[urcu.git] / urcu / system.h
1 #ifndef _URCU_SYSTEM_H
2 #define _URCU_SYSTEM_H
3
4 /*
5 * system.h
6 *
7 * System definitions.
8 *
9 * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 */
21
22 #include <urcu/compiler.h>
23 #include <urcu/arch.h>
24
25 /*
26 * Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come
27 * before the load.
28 */
29 #define _CMM_LOAD_SHARED(p) CMM_ACCESS_ONCE(p)
30
31 /*
32 * Load a data from shared memory, doing a cache flush if required.
33 */
34 #define CMM_LOAD_SHARED(p) \
35 __extension__ \
36 ({ \
37 cmm_smp_rmc(); \
38 _CMM_LOAD_SHARED(p); \
39 })
40
41 /*
42 * Identify a shared store. A cmm_smp_wmc() or cmm_smp_mc() should
43 * follow the store.
44 */
45 #define _CMM_STORE_SHARED(x, v) __extension__ ({ CMM_ACCESS_ONCE(x) = (v); })
46
47 /*
48 * Store v into x, where x is located in shared memory. Performs the
49 * required cache flush after writing. Returns v.
50 */
51 #define CMM_STORE_SHARED(x, v) \
52 __extension__ \
53 ({ \
54 __typeof__(x) _v = _CMM_STORE_SHARED(x, v); \
55 cmm_smp_wmc(); \
56 _v = _v; /* Work around clang "unused result" */ \
57 })
58
59 #endif /* _URCU_SYSTEM_H */
This page took 0.029444 seconds and 4 git commands to generate.