2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

dpif: Serialize initialization.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2013-04-23 14:35:29 -07:00
parent 811d6451a1
commit eb8ed438c2
2 changed files with 8 additions and 5 deletions

View File

@@ -97,15 +97,15 @@ static void log_execute_message(struct dpif *, const struct dpif_execute *,
static void
dp_initialize(void)
{
static int status = -1;
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
if (status < 0) {
if (ovsthread_once_start(&once)) {
int i;
status = 0;
for (i = 0; i < ARRAY_SIZE(base_dpif_classes); i++) {
dp_register_provider(base_dpif_classes[i]);
}
ovsthread_once_done(&once);
}
}