summaryrefslogtreecommitdiff
path: root/pr/src/md/os2/os2thred.c
diff options
context:
space:
mode:
Diffstat (limited to 'pr/src/md/os2/os2thred.c')
-rw-r--r--pr/src/md/os2/os2thred.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/pr/src/md/os2/os2thred.c b/pr/src/md/os2/os2thred.c
index d64ae0b9..6b83869f 100644
--- a/pr/src/md/os2/os2thred.c
+++ b/pr/src/md/os2/os2thred.c
@@ -93,14 +93,6 @@ PRStatus
_PR_MD_INIT_THREAD(PRThread *thread)
{
APIRET rv;
-#ifdef XP_OS2_EMX
- /* disable SIGPIPE */
- struct sigaction sa;
- sa.sa_handler = SIG_IGN;
- sa.sa_flags = 0;
- sigemptyset( &sa.sa_mask);
- sigaction( SIGPIPE, &sa, NULL);
-#endif
if (thread->flags & (_PR_PRIMORDIAL | _PR_ATTACHED)) {
_pr_SetThreadMDHandle(thread);
@@ -119,15 +111,22 @@ _PR_MD_CREATE_THREAD(PRThread *thread,
PRThreadState state,
PRUint32 stackSize)
{
- thread->md.handle = thread->id = (TID) _beginthread(
- (void(* _Optlink)(void*))start,
- NULL,
- thread->stack->stackSize,
- thread);
+ thread->md.handle = thread->id = (TID) _beginthread(start,
+ NULL,
+ thread->stack->stackSize,
+ thread);
if(thread->md.handle == -1) {
return PR_FAILURE;
}
- _PR_MD_SET_PRIORITY(&(thread->md), priority);
+
+ /*
+ * On OS/2, a thread is created with a thread priority of
+ * THREAD_PRIORITY_NORMAL
+ */
+
+ if (priority != PR_PRIORITY_NORMAL) {
+ _PR_MD_SET_PRIORITY(&(thread->md), priority);
+ }
return PR_SUCCESS;
}
@@ -270,3 +269,19 @@ _PR_MD_RESUME_THREAD(PRThread *thread)
}
}
+
+PRThread*
+_MD_CURRENT_THREAD(void)
+{
+ PRThread *thread;
+
+ thread = _MD_GET_ATTACHED_THREAD();
+
+ if (NULL == thread) {
+ thread = _PRI_AttachThread(PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL, 0);
+ }
+
+ PR_ASSERT(thread != NULL);
+ return thread;
+}
+