X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofp-msgs.c;h=d136f73d47cefd457a249d2c0a21d360d3178db3;hb=fd76a6f94338b668175336434b156827458b5e7d;hp=5e043d2450898b25432f3473bf1199028739fe7d;hpb=cc36576070df622d0fc7a6e26ce01027e12b5b59;p=sliver-openvswitch.git diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c index 5e043d245..d136f73d4 100644 --- a/lib/ofp-msgs.c +++ b/lib/ofp-msgs.c @@ -110,8 +110,11 @@ static enum ofperr ofpraw_from_ofphdrs(enum ofpraw *, const struct ofphdrs *); static ovs_be32 alloc_xid(void) { - static uint32_t next_xid = 1; - return htonl(next_xid++); + static atomic_uint32_t next_xid = ATOMIC_VAR_INIT(1); + uint32_t xid; + + atomic_add(&next_xid, 1, &xid); + return htonl(xid); } static uint32_t