X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=blobdiff_plain;f=lib%2Fnetdev.c;h=45a416520767d68d5d2c28b593172b2872939028;hp=4736a97e6e8d933b79f9bd38deae9ff31359c75d;hb=a4fdb0f3bdbfff1924afefd19239260ed429c193;hpb=a7ae938074d1c5e25e484eb7b6aca3f101adea38 diff --git a/lib/netdev.c b/lib/netdev.c index 4736a97e6..45a416520 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -102,13 +102,25 @@ netdev_is_pmd(const struct netdev *netdev) } static void -netdev_initialize(void) +netdev_class_mutex_initialize(void) OVS_EXCLUDED(netdev_class_mutex, netdev_mutex) { static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; if (ovsthread_once_start(&once)) { ovs_mutex_init_recursive(&netdev_class_mutex); + ovsthread_once_done(&once); + } +} + +static void +netdev_initialize(void) + OVS_EXCLUDED(netdev_class_mutex, netdev_mutex) +{ + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; + + if (ovsthread_once_start(&once)) { + netdev_class_mutex_initialize(); fatal_signal_add_hook(restore_all_flags, NULL, NULL, true); netdev_vport_patch_register(); @@ -190,6 +202,7 @@ netdev_register_provider(const struct netdev_class *new_class) { int error; + netdev_class_mutex_initialize(); ovs_mutex_lock(&netdev_class_mutex); if (netdev_lookup_class(new_class->type)) { VLOG_WARN("attempted to register duplicate netdev provider: %s",