src/server/ucx/atomic.c

Sat, 15 Dec 2012 16:05:03 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 15 Dec 2012 16:05:03 +0100
changeset 37
360b9aabe17e
parent 36
450d2d5f4735
permissions
-rw-r--r--

added support for asynchronous safs

33
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 *
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 */
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 #include <atomic.h>
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 #include "atomic.h"
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 void ucx_atomic_inc_8(volatile uint8_t *t) {
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 atomic_inc_8(t);
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 }
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 void ucx_atomic_inc_16(volatile uint16_t *t) {
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 atomic_inc_16(t);
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 }
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 void ucx_atomic_inc_32(volatile uint32_t *t) {
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 atomic_inc_32(t);
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 }
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 void ucx_atomic_inc_64(volatile uint64_t *t) {
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 atomic_inc_64(t);
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 }
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24
36
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
25 void ucx_atomic_dec_8(volatile uint8_t *t) {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
26 atomic_dec_8(t);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
27 }
33
96dbfe4f91e5 improved configuration loading
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
36
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
29 void ucx_atomic_dec_16(volatile uint16_t *t) {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
30 atomic_dec_16(t);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
31 }
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
32
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
33 void ucx_atomic_dec_32(volatile uint32_t *t) {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
34 atomic_dec_32(t);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
35 }
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
36
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
37 void ucx_atomic_dec_64(volatile uint64_t *t) {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
38 atomic_dec_64(t);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
39 }
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
40
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
41 uint8_t ucx_atomic_dec_8_nv(volatile uint8_t *t) {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
42 return atomic_dec_8_nv(t);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
43 }
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
44
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
45 uint16_t ucx_atomic_dec_16_nv(volatile uint16_t *t) {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
46 return atomic_dec_16_nv(t);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
47 }
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
48
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
49 uint32_t ucx_atomic_dec_32_nv(volatile uint32_t *t) {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
50 return atomic_dec_32_nv(t);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
51 }
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
52
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
53 uint64_t ucx_atomic_dec_64_nv(volatile uint64_t *t) {
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
54 return atomic_dec_64_nv(t);
450d2d5f4735 server can reload configuration
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 33
diff changeset
55 }

mercurial