diff options
author | RĂ©mi Denis-Courmont <remi@remlab.net> | 2010-12-14 04:12:40 +0200 |
---|---|---|
committer | Peter Harris <pharris@opentext.com> | 2010-12-23 12:36:50 -0500 |
commit | 79b3c3831b49c3fd39d84584d93d93dd818508dd (patch) | |
tree | 147c80a4ef3e23985d49e6e1ba5d0c7923a46b88 | |
parent | 28693b4713eb50a395557a1cc1673f8f07579d4d (diff) | |
download | xcb-pthread-stubs-79b3c3831b49c3fd39d84584d93d93dd818508dd.tar.gz |
pthread_self(): do not assume pthread_t and int are compatible
POSIX does not warrant much about pthread_t.
It is not necessarily the same convertible to int as far as the calling
conventions are concerned.
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Harris <pharris@opentext.com>
-rw-r--r-- | list.m4 | 2 | ||||
-rw-r--r-- | stubs.c.m4 | 11 |
2 files changed, 12 insertions, 1 deletions
@@ -1,4 +1,4 @@ -alias(zero, int, pthread_self) +alias(self, pthread_t, pthread_self) alias(zero, int, pthread_mutex_init) alias(zero, int, pthread_mutex_destroy) alias(zero, int, pthread_mutex_lock) @@ -47,6 +47,7 @@ m4_divert(0)m4_dnl #include <pthread.h> #include <stdlib.h> +#include <string.h> #include "config.h" m4_include([list.m4]) @@ -65,6 +66,16 @@ static int __pthread_abort_stub() } #endif +#ifdef NEED_SELF_STUB +static pthread_t __pthread_self_stub(void) +{ + pthread_t th; + + memset(&th, 0, sizeof (th)); + return th; +} +#endif + #ifdef NEED_EQUAL_STUB static int __pthread_equal_stub(pthread_t t1, pthread_t t2) { |