Signed-off-by: Ben Pfaff <b...@nicira.com> --- lib/ofp-msgs.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c index 5e043d2..8bb1754 100644 --- a/lib/ofp-msgs.c +++ b/lib/ofp-msgs.c @@ -111,7 +111,14 @@ static ovs_be32 alloc_xid(void) { static uint32_t next_xid = 1; - return htonl(next_xid++); + static pthread_mutex_t mutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER; + uint32_t xid; + + xpthread_mutex_lock(&mutex); + xid = next_xid++; + xpthread_mutex_unlock(&mutex); + + return htonl(xid); } static uint32_t -- 1.7.2.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev