diff options
author | Ben Pfaff <blp@nicira.com> | 2013-04-26 11:22:19 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-07-23 11:38:00 -0700 |
commit | a944ef4079538b9a2ed9d754554314b1539bf304 (patch) | |
tree | 0590b46714b0837370318a061cdb8bfa9710652c /lib/ofp-parse.c | |
parent | 238821156596c227f4a32a8c3c4ad891591a1802 (diff) |
ofp-parse: Make parse_ofp_str() thread-safe.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Diffstat (limited to 'lib/ofp-parse.c')
-rw-r--r-- | lib/ofp-parse.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 618290b7..4b8036db 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -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,16 @@ static char * WARN_UNUSED_RESULT parse_flow_monitor_request__(struct ofputil_flow_monitor_request *fmr, const char *str_, char *string) { + static pthread_mutex_t mutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER; static uint32_t id; char *save_ptr = NULL; char *name; + xpthread_mutex_lock(&mutex); fmr->id = id++; + xpthread_mutex_unlock(&mutex); + fmr->flags = (NXFMF_INITIAL | NXFMF_ADD | NXFMF_DELETE | NXFMF_MODIFY | NXFMF_OWN | NXFMF_ACTIONS); fmr->out_port = OFPP_NONE; |