diff mbox

[ovs-dev] Windows tests: Applications abort when using threading (ovs_rwlock_init)

Message ID DM5PR05MB31932BCFF42D1A42F332079FA2680@DM5PR05MB3193.namprd05.prod.outlook.com
State Not Applicable
Headers show

Commit Message

Shashank Ram Dec. 28, 2016, 10:33 p.m. UTC
Acked-by: Shashank Ram <rams@vmware.com>
diff mbox

Patch

diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
index 058c434..55c1990 100644
--- a/lib/ovs-thread.c
+++ b/lib/ovs-thread.c
@@ -240,7 +240,13 @@  ovs_rwlock_init(const struct ovs_rwlock *l_)
     xpthread_rwlockattr_setkind_np(
         &attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
 #endif
+#ifdef _WIN32
+    /* XXX: The version of pthreads until 2.9.1 and including do not support
+     * pthread_rwlock_init with an initialized attribute */
+    error = pthread_rwlock_init(&l->lock, NULL);
+#else
     error = pthread_rwlock_init(&l->lock, &attr);
+#endif
     if (OVS_UNLIKELY(error)) {
         ovs_abort(error, "pthread_rwlock_init failed");
     }