Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/ovs-thread.c |    1 +
 lib/ovs-thread.h |    5 +++--
 lib/poll-loop.c  |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
index 4d64b92..d0ec9ec 100644
--- a/lib/ovs-thread.c
+++ b/lib/ovs-thread.c
@@ -128,6 +128,7 @@ XPTHREAD_FUNC1(pthread_cond_broadcast, pthread_cond_t *);
 
 typedef void destructor_func(void *);
 XPTHREAD_FUNC2(pthread_key_create, pthread_key_t *, destructor_func *);
+XPTHREAD_FUNC2(pthread_setspecific, pthread_key_t, const void *);
 
 void
 ovs_mutex_init(const struct ovs_mutex *l_, int type)
diff --git a/lib/ovs-thread.h b/lib/ovs-thread.h
index 9b8eeef..0d54a43 100644
--- a/lib/ovs-thread.h
+++ b/lib/ovs-thread.h
@@ -153,6 +153,7 @@ void xpthread_cond_broadcast(pthread_cond_t *);
 #endif
 
 void xpthread_key_create(pthread_key_t *, void (*destructor)(void *));
+void xpthread_setspecific(pthread_key_t, const void *);
 
 void xpthread_create(pthread_t *, pthread_attr_t *, void *(*)(void *), void *);
 
@@ -277,7 +278,7 @@ void xpthread_create(pthread_t *, pthread_attr_t *, void 
*(*)(void *), void *);
                                                                         \
             value = xmalloc(sizeof *value);                             \
             *value = initial_value;                                     \
-            pthread_setspecific(NAME##_key, value);                     \
+            xpthread_setspecific(NAME##_key, value);                    \
         }                                                               \
         return value;                                                   \
     }
@@ -348,7 +349,7 @@ void xpthread_create(pthread_t *, pthread_attr_t *, void 
*(*)(void *), void *);
     NAME##_set_unsafe(TYPE value)                       \
     {                                                   \
         TYPE old_value = NAME##_get_unsafe();           \
-        pthread_setspecific(NAME##_key, value);         \
+        xpthread_setspecific(NAME##_key, value);        \
         return old_value;                               \
     }                                                   \
                                                         \
diff --git a/lib/poll-loop.c b/lib/poll-loop.c
index 0f45d98..5f9b9cd 100644
--- a/lib/poll-loop.c
+++ b/lib/poll-loop.c
@@ -275,7 +275,7 @@ poll_loop(void)
     loop = pthread_getspecific(key);
     if (!loop) {
         loop = xzalloc(sizeof *loop);
-        pthread_setspecific(key, loop);
+        xpthread_setspecific(key, loop);
     }
     return loop;
 }
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to