Bug 741272 - Implement raise() using pthread_kill() so the signal will be sent to the the caller thread instead of a random thread in the thread group. r=blassey,khuey

This commit is contained in:
Cervantes Yu 2012-04-02 17:59:29 +08:00
parent 3bc848ff14
commit 01de3d9145
3 changed files with 17 additions and 1 deletions

View File

@ -7230,7 +7230,7 @@ if test "$OS_TARGET" = Android; then
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
fi
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork"
WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
fi
dnl ========================================================

View File

@ -49,6 +49,7 @@
#include <sys/mman.h>
#include <sys/limits.h>
#include <errno.h>
#include <pthread.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@ -1082,3 +1083,10 @@ __wrap_fork(void)
}
return pid;
}
extern "C" NS_EXPORT int
__wrap_raise(int sig)
{
return pthread_kill(pthread_self(), sig);
}

View File

@ -4,6 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <unistd.h>
#include <pthread.h>
#include <vector>
#define NS_EXPORT __attribute__ ((visibility("default")))
@ -51,3 +52,10 @@ __wrap_fork(void)
}
return pid;
}
extern "C" NS_EXPORT int
__wrap_raise(int sig)
{
return pthread_kill(pthread_self(), sig);
}