mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-23 22:33:28 +00:00
Fixed incorrect usage of pthread_create when testing a non-GNU runtime
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@31240 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
740c4a7f56
commit
d2155ecd42
2 changed files with 15 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2010-09-06 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* config_thread.m: Fixed incorrect usage of pthread_create when
|
||||
testing a non-GNU runtime.
|
||||
|
||||
2010-09-06 Nicola Pero <nicola.pero@meta-innovation.com>
|
||||
|
||||
* configure.ac: Enable native exceptions by default if the
|
||||
|
|
|
@ -9,6 +9,12 @@
|
|||
|
||||
#ifdef GNU_RUNTIME
|
||||
#include <objc/thr.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
void *dummy_thread_function(void *dummy)
|
||||
{
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <objc/Object.h>
|
||||
|
@ -16,16 +22,17 @@
|
|||
int
|
||||
main()
|
||||
{
|
||||
#ifdef GNU_RUNTIME
|
||||
id o = [Object new];
|
||||
|
||||
#ifdef GNU_RUNTIME
|
||||
return (objc_thread_detach (@selector(hash), o, nil) == NULL) ? -1 : 0;
|
||||
#else
|
||||
|
||||
/* On Apple, there is no ObjC-specific thread library. We need to
|
||||
* use pthread directly.
|
||||
*/
|
||||
pthread_t thread_id;
|
||||
int error = pthread_create (&thread_id, NULL, @selector(hash), o);
|
||||
int error = pthread_create (&thread_id, NULL, dummy_thread_function, NULL);
|
||||
|
||||
if (error != 0)
|
||||
{
|
||||
|
@ -33,5 +40,6 @@ main()
|
|||
}
|
||||
|
||||
return 0;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue