Impement test for main thread on linux

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38443 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2015-03-31 09:45:40 +00:00
parent 33688ccb99
commit 82e156d9cb
6 changed files with 37 additions and 24 deletions

View file

@ -89,18 +89,20 @@
# include <pthread_np.h>
#endif
#if defined(__FreeBSD__) || defined(__OpenBSD__)
# define IS_MAIN_PTHREAD (pthread_main_np() == 1)
#else
# define IS_MAIN_PTHREAD (1)
#endif
#if defined(HAVE_GETTID)
# include <unistd.h>
# include <sys/syscall.h>
# include <sys/types.h>
#endif
#if defined(HAVE_PTHREAD_MAIN_NP)
# define IS_MAIN_PTHREAD (pthread_main_np() == 1)
#elif defined(HAVE_GETTID)
# define IS_MAIN_PTHREAD (getpid() == (pid_t)syscall(SYS_gettid))
#else
# define IS_MAIN_PTHREAD (1)
#endif
/* Return the current thread ID as an unsigned long.
* Ideally, we use the operating-system's notion of a thread ID so
* that external process monitoring software will be using the same
@ -845,7 +847,6 @@ unregisterActiveThread(NSThread *thread)
}
[_target performSelector: _selector withObject: _arg];
}
- (NSString*) name