Looks good to me, Want to ask question about "ovsthread_once_start()", 1. why do we have "ovsthread_once_start()" defined in header file?
2. if __check__ is defined, the macro function will override the previously defined "ovsthread_once_start()" function. Right? 3. could you explain why you use "ovsthread_once_start()" rather than "pthread_once()" like in other patches (since the init function does not take any input argument)? Thanks, Alex Wang, On Thu, Jul 18, 2013 at 4:15 PM, Ben Pfaff <b...@nicira.com> wrote: > Signed-off-by: Ben Pfaff <b...@nicira.com> > --- > lib/ofp-msgs.c | 6 +++++- > 1 files changed, 5 insertions(+), 1 deletions(-) > > diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c > index af4178e..5e043d2 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); > } > -- > 1.7.2.5 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev