git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clang: Add annotations for thread safety check.
[sliver-openvswitch.git]
/
lib
/
ofp-msgs.c
diff --git
a/lib/ofp-msgs.c
b/lib/ofp-msgs.c
index
8bb1754
..
d136f73
100644
(file)
--- a/
lib/ofp-msgs.c
+++ b/
lib/ofp-msgs.c
@@
-110,14
+110,10
@@
static enum ofperr ofpraw_from_ofphdrs(enum ofpraw *, const struct ofphdrs *);
static ovs_be32
alloc_xid(void)
{
static ovs_be32
alloc_xid(void)
{
- static uint32_t next_xid = 1;
- static pthread_mutex_t mutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER;
+ static atomic_uint32_t next_xid = ATOMIC_VAR_INIT(1);
uint32_t xid;
uint32_t xid;
- xpthread_mutex_lock(&mutex);
- xid = next_xid++;
- xpthread_mutex_unlock(&mutex);
-
+ atomic_add(&next_xid, 1, &xid);
return htonl(xid);
}
\f
return htonl(xid);
}
\f