diff options
author | Jarno Rajahalme <jrajahalme@nicira.com> | 2014-08-29 10:34:52 -0700 |
---|---|---|
committer | Jarno Rajahalme <jrajahalme@nicira.com> | 2014-08-29 10:34:52 -0700 |
commit | ca4fbdfe52f4dee36391fb8ec006ee2190a339fc (patch) | |
tree | 52d5ffd2a39d00114aa8bab156a2d25fe76f66be /lib/jsonrpc.c | |
parent | 91a96379e5e0942b6d963ff1538eccc5ba46a697 (diff) | |
download | openvswitch-ca4fbdfe52f4dee36391fb8ec006ee2190a339fc.tar.gz |
lib/jsonrpc, lib/ofp-msgs, lib/ofp-parse: Use atomic_count.
Trivial ID counters do not synchronize anything, therefore can use
atomic_count.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/jsonrpc.c')
-rw-r--r-- | lib/jsonrpc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c index 842d1173a..0841ad81d 100644 --- a/lib/jsonrpc.c +++ b/lib/jsonrpc.c @@ -516,10 +516,10 @@ jsonrpc_create(enum jsonrpc_msg_type type, const char *method, static struct json * jsonrpc_create_id(void) { - static atomic_uint next_id = ATOMIC_VAR_INIT(0); + static atomic_count next_id = ATOMIC_COUNT_INIT(0); unsigned int id; - atomic_add(&next_id, 1, &id); + id = atomic_count_inc(&next_id); return json_integer_create(id); } |