summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2003-03-22 14:55:26 +0000
committerwtc%netscape.com <devnull@localhost>2003-03-22 14:55:26 +0000
commit5c6226f80be2eacf83b8af53b1d83287afcf3427 (patch)
tree12e3bf50deef3e8106322d8d640c5d6cc061a92b
parent9e80181f79e86fdc439c2208c6b41690ea4ef360 (diff)
downloadnspr-hg-5c6226f80be2eacf83b8af53b1d83287afcf3427.tar.gz
Bug 198634: fixes to OS/2 threading code. The patch is contributed by
Javier Pedemonte <pedemont@us.ibm.com>. r=mkaply. r=wtc. Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH Modified files: _os2.h primpl.h os2thred.c
-rw-r--r--pr/include/md/_os2.h3
-rw-r--r--pr/include/private/primpl.h2
-rw-r--r--pr/src/md/os2/os2thred.c16
3 files changed, 19 insertions, 2 deletions
diff --git a/pr/include/md/_os2.h b/pr/include/md/_os2.h
index 98d9b530..22fddd20 100644
--- a/pr/include/md/_os2.h
+++ b/pr/include/md/_os2.h
@@ -482,7 +482,8 @@ typedef struct __NSPR_TLS
extern _NSPR_TLS* pThreadLocalStorage;
NSPR_API(void) _PR_MD_ENSURE_TLS(void);
-#define _MD_CURRENT_THREAD() pThreadLocalStorage->_pr_currentThread
+#define _MD_GET_ATTACHED_THREAD() pThreadLocalStorage->_pr_currentThread
+extern struct PRThread * _MD_CURRENT_THREAD(void);
#define _MD_SET_CURRENT_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentThread = (_thread)
#define _MD_LAST_THREAD() pThreadLocalStorage->_pr_thread_last_run
diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h
index 830d1332..b0cd1b5b 100644
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -304,7 +304,7 @@ typedef struct _PRInterruptTable {
#define _PR_CPU_PTR(_qp) \
((_PRCPU*) ((char*) (_qp) - offsetof(_PRCPU,links)))
-#if !defined(IRIX) && !defined(WIN32)
+#if !defined(IRIX) && !defined(WIN32) && !defined(XP_OS2)
#define _MD_GET_ATTACHED_THREAD() (_PR_MD_CURRENT_THREAD())
#endif
diff --git a/pr/src/md/os2/os2thred.c b/pr/src/md/os2/os2thred.c
index f05be463..7c06126f 100644
--- a/pr/src/md/os2/os2thred.c
+++ b/pr/src/md/os2/os2thred.c
@@ -278,3 +278,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;
+}
+