Bug 936341 - Get NSPR emulation working on BSD. r=billm

This commit is contained in:
Feiko Koopman 2013-11-11 09:16:47 -05:00
parent 72a8653132
commit 2249872963
2 changed files with 10 additions and 1 deletions

View File

@ -2916,7 +2916,7 @@ if test "$_USE_SYSTEM_NSPR" || (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
fi
case "$target" in
*linux*|*darwin*)
*linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*)
if test -z "$_HAS_NSPR"; then JS_POSIX_NSPR_DEFAULT=1; fi
;;
esac

View File

@ -14,6 +14,10 @@
#include <sys/time.h>
#include <time.h>
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#include <pthread_np.h>
#endif
class nspr::Thread
{
pthread_t pthread_;
@ -146,6 +150,11 @@ PR_SetCurrentThreadName(const char *name)
int result;
#ifdef XP_MACOSX
result = pthread_setname_np(name);
#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
pthread_set_name_np(pthread_self(), name);
result = 0;
#elif defined(__NetBSD__)
result = pthread_setname_np(pthread_self(), "%s", (void *)name);
#else
result = pthread_setname_np(pthread_self(), name);
#endif