X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fovsdb-data.c;h=ade1971c3885be572fc137c4a90b353d73153040;hb=b2f2acd543f159ba984a00059892917933612a10;hp=7ec769479e903f088794d85c77781259462d7319;hpb=780325b5b8d4c0552b4b7719e0a38200d99f6b08;p=sliver-openvswitch.git diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c index 7ec769479..ade1971c3 100644 --- a/lib/ovsdb-data.c +++ b/lib/ovsdb-data.c @@ -24,6 +24,7 @@ #include "dynamic-string.h" #include "hash.h" +#include "ovs-thread.h" #include "ovsdb-error.h" #include "ovsdb-parser.h" #include "json.h" @@ -94,9 +95,9 @@ const union ovsdb_atom * ovsdb_atom_default(enum ovsdb_atomic_type type) { static union ovsdb_atom default_atoms[OVSDB_N_TYPES]; - static bool inited; + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; - if (!inited) { + if (ovsthread_once_start(&once)) { int i; for (i = 0; i < OVSDB_N_TYPES; i++) { @@ -104,7 +105,7 @@ ovsdb_atom_default(enum ovsdb_atomic_type type) ovsdb_atom_init_default(&default_atoms[i], i); } } - inited = true; + ovsthread_once_done(&once); } ovs_assert(ovsdb_atomic_type_is_valid(type));