summaryrefslogtreecommitdiff
path: root/pr/tests/foreign.c
diff options
context:
space:
mode:
Diffstat (limited to 'pr/tests/foreign.c')
-rw-r--r--pr/tests/foreign.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/pr/tests/foreign.c b/pr/tests/foreign.c
index 2fe48b1b..5457cc8c 100644
--- a/pr/tests/foreign.c
+++ b/pr/tests/foreign.c
@@ -63,7 +63,7 @@
#include <stdlib.h>
static enum {
- thread_nspr, thread_pthread, thread_sproc, thread_win32
+ thread_nspr, thread_pthread, thread_uithread, thread_sproc, thread_win32
} thread_provider;
typedef void (*StartFn)(void*);
@@ -94,6 +94,18 @@ static void *pthread_start(void *arg)
} /* pthread_start */
#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
+#if defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
+#include <thread.h>
+static void *uithread_start(void *arg)
+{
+ StartFn start = ((StartObject*)arg)->start;
+ void *data = ((StartObject*)arg)->arg;
+ PR_Free(arg);
+ start(data);
+ return NULL;
+} /* uithread_start */
+#endif /* defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY) */
+
#if defined(IRIX) && !defined(_PR_PTHREADS)
#include <sys/types.h>
#include <sys/prctl.h>
@@ -169,6 +181,29 @@ static PRStatus CreateThread(StartFn start, void *arg)
break;
#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
+ case thread_uithread:
+#if defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
+ {
+ int rv;
+ thread_t id;
+ long flags;
+ StartObject *start_object;
+ start_object = PR_NEW(StartObject);
+ PR_ASSERT(NULL != start_object);
+ start_object->start = start;
+ start_object->arg = arg;
+
+ flags = THR_DETACHED;
+
+ rv = thr_create(NULL, NULL, uithread_start, start_object, flags, &id);
+ return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
+ }
+#else
+ PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
+ rv = PR_FAILURE;
+ break;
+#endif /* defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY) */
+
case thread_sproc:
#if defined(IRIX) && !defined(_PR_PTHREADS)
{
@@ -335,6 +370,8 @@ PRIntn main(PRIntn argc, char **argv)
thread_provider = thread_win32;
#elif defined(_PR_PTHREADS)
thread_provider = thread_pthread;
+#elif defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)
+ thread_provider = thread_uithread;
#elif defined(IRIX)
thread_provider = thread_sproc;
#else