From: Ben Pfaff Date: Wed, 19 Jun 2013 18:41:06 +0000 (-0700) Subject: ofp-msgs: Make thread-safe. X-Git-Tag: sliver-openvswitch-2.0.90-1~35^2~13 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=06717cbd62f400c0596bd0bbcf0fc8fb03c7801c;p=sliver-openvswitch.git ofp-msgs: Make thread-safe. Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c index af4178eb4..5e043d245 100644 --- a/lib/ofp-msgs.c +++ b/lib/ofp-msgs.c @@ -23,6 +23,7 @@ #include "ofpbuf.h" #include "openflow/nicira-ext.h" #include "openflow/openflow.h" +#include "ovs-thread.h" #include "vlog.h" VLOG_DEFINE_THIS_MODULE(ofp_msgs); @@ -988,9 +989,10 @@ ofpraw_from_ofphdrs(enum ofpraw *raw, const struct ofphdrs *hdrs) static void ofpmsgs_init(void) { + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; const struct raw_info *info; - if (raw_instance_map.buckets) { + if (!ovsthread_once_start(&once)) { return; } @@ -1008,4 +1010,6 @@ ofpmsgs_init(void) ofphdrs_hash(&inst->hdrs)); } } + + ovsthread_once_done(&once); }