X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofp-msgs.c;h=d136f73d47cefd457a249d2c0a21d360d3178db3;hb=97be153858b4cd175cbe7862b8e1624bf22ab98a;hp=8bb1754f6015fb20571807e0cce6676792df46e2;hpb=2b51596fdeba7fbf4caff323dd6af375e7f84596;p=sliver-openvswitch.git diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c index 8bb1754f6..d136f73d4 100644 --- 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 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; - xpthread_mutex_lock(&mutex); - xid = next_xid++; - xpthread_mutex_unlock(&mutex); - + atomic_add(&next_xid, 1, &xid); return htonl(xid); }