Following the linux version.

Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 lib/route-table-bsd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/route-table-bsd.c b/lib/route-table-bsd.c
index b606059..3608389 100644
--- a/lib/route-table-bsd.c
+++ b/lib/route-table-bsd.c
@@ -30,8 +30,10 @@
 #include <unistd.h>
 
 #include "ovs-router.h"
+#include "ovs-thread.h"
 #include "util.h"
 
+static struct ovs_mutex route_table_mutex = OVS_MUTEX_INITIALIZER;
 static int pid;
 static unsigned int register_count = 0;
 
@@ -117,27 +119,35 @@ route_table_get_change_seq(void)
 
 void
 route_table_register(void)
+    OVS_EXCLUDED(route_table_mutex)
 {
+    ovs_mutex_lock(&route_table_mutex);
     if (!register_count)
     {
         pid = getpid();
     }
 
     register_count++;
+    ovs_mutex_unlock(&route_table_mutex);
 }
 
 void
 route_table_unregister(void)
+    OVS_EXCLUDED(route_table_mutex)
 {
+    ovs_mutex_lock(&route_table_mutex);
     register_count--;
+    ovs_mutex_unlock(&route_table_mutex);
 }
 
 void
 route_table_run(void)
+    OVS_EXCLUDED(route_table_mutex)
 {
 }
 
 void
 route_table_wait(void)
+    OVS_EXCLUDED(route_table_mutex)
 {
 }
-- 
1.9.4

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to