clang: Add annotations for thread safety check.
[sliver-openvswitch.git] / lib / ofp-parse.c
index 618290b..5cb39f5 100644 (file)
@@ -34,6 +34,7 @@
 #include "ofp-util.h"
 #include "ofpbuf.h"
 #include "openflow/openflow.h"
+#include "ovs-thread.h"
 #include "packets.h"
 #include "socket-util.h"
 #include "vconn.h"
@@ -1519,12 +1520,12 @@ static char * WARN_UNUSED_RESULT
 parse_flow_monitor_request__(struct ofputil_flow_monitor_request *fmr,
                              const char *str_, char *string)
 {
-    static uint32_t id;
-
+    static atomic_uint32_t id = ATOMIC_VAR_INIT(0);
     char *save_ptr = NULL;
     char *name;
 
-    fmr->id = id++;
+    atomic_add(&id, 1, &fmr->id);
+
     fmr->flags = (NXFMF_INITIAL | NXFMF_ADD | NXFMF_DELETE | NXFMF_MODIFY
                   | NXFMF_OWN | NXFMF_ACTIONS);
     fmr->out_port = OFPP_NONE;