summaryrefslogtreecommitdiff
path: root/nsprpub/pr/src/md/os2/os2thred.c
diff options
context:
space:
mode:
Diffstat (limited to 'nsprpub/pr/src/md/os2/os2thred.c')
-rw-r--r--nsprpub/pr/src/md/os2/os2thred.c114
1 files changed, 57 insertions, 57 deletions
diff --git a/nsprpub/pr/src/md/os2/os2thred.c b/nsprpub/pr/src/md/os2/os2thred.c
index edb9f5f0c5..aa929a1a23 100644
--- a/nsprpub/pr/src/md/os2/os2thred.c
+++ b/nsprpub/pr/src/md/os2/os2thred.c
@@ -16,37 +16,37 @@ APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
void
_PR_MD_ENSURE_TLS(void)
{
- if(!pThreadLocalStorage)
- {
- /* Allocate thread local storage (TLS). Note, that only 32 bytes can
- * be allocated at a time.
- */
- int rc = DosAllocThreadLocalMemory(sizeof(_NSPR_TLS) / 4, (PULONG*)&pThreadLocalStorage);
- PR_ASSERT(rc == NO_ERROR);
- memset(pThreadLocalStorage, 0, sizeof(_NSPR_TLS));
- }
+ if(!pThreadLocalStorage)
+ {
+ /* Allocate thread local storage (TLS). Note, that only 32 bytes can
+ * be allocated at a time.
+ */
+ int rc = DosAllocThreadLocalMemory(sizeof(_NSPR_TLS) / 4, (PULONG*)&pThreadLocalStorage);
+ PR_ASSERT(rc == NO_ERROR);
+ memset(pThreadLocalStorage, 0, sizeof(_NSPR_TLS));
+ }
}
void
_PR_MD_EARLY_INIT()
{
- HMODULE hmod;
+ HMODULE hmod;
- if (DosLoadModule(NULL, 0, "DOSCALL1", &hmod) == 0)
- DosQueryProcAddr(hmod, 877, "DOSQUERYTHREADCONTEXT",
- (PFN *)&QueryThreadContext);
+ if (DosLoadModule(NULL, 0, "DOSCALL1", &hmod) == 0)
+ DosQueryProcAddr(hmod, 877, "DOSQUERYTHREADCONTEXT",
+ (PFN *)&QueryThreadContext);
}
static void
_pr_SetThreadMDHandle(PRThread *thread)
{
- PTIB ptib;
- PPIB ppib;
- PRUword rc;
+ PTIB ptib;
+ PPIB ppib;
+ PRUword rc;
- rc = DosGetInfoBlocks(&ptib, &ppib);
+ rc = DosGetInfoBlocks(&ptib, &ppib);
- thread->md.handle = ptib->tib_ptib2->tib2_ultid;
+ thread->md.handle = ptib->tib_ptib2->tib2_ultid;
}
/* On OS/2, some system function calls seem to change the FPU control word,
@@ -134,15 +134,15 @@ PR_OS2_UnsetFloatExcpHandler(EXCEPTIONREGISTRATIONRECORD* excpreg)
PRStatus
_PR_MD_INIT_THREAD(PRThread *thread)
{
- APIRET rv;
+ APIRET rv;
- if (thread->flags & (_PR_PRIMORDIAL | _PR_ATTACHED)) {
- _pr_SetThreadMDHandle(thread);
- }
+ if (thread->flags & (_PR_PRIMORDIAL | _PR_ATTACHED)) {
+ _pr_SetThreadMDHandle(thread);
+ }
- /* Create the blocking IO semaphore */
- rv = DosCreateEventSem(NULL, &(thread->md.blocked_sema), 0, 0);
- return (rv == NO_ERROR) ? PR_SUCCESS : PR_FAILURE;
+ /* Create the blocking IO semaphore */
+ rv = DosCreateEventSem(NULL, &(thread->md.blocked_sema), 0, 0);
+ return (rv == NO_ERROR) ? PR_SUCCESS : PR_FAILURE;
}
typedef struct param_store
@@ -169,20 +169,20 @@ ExcpStartFunc(void* arg)
}
PRStatus
-_PR_MD_CREATE_THREAD(PRThread *thread,
- void (*start)(void *),
- PRThreadPriority priority,
- PRThreadScope scope,
- PRThreadState state,
- PRUint32 stackSize)
+_PR_MD_CREATE_THREAD(PRThread *thread,
+ void (*start)(void *),
+ PRThreadPriority priority,
+ PRThreadScope scope,
+ PRThreadState state,
+ PRUint32 stackSize)
{
PARAMSTORE* params = PR_Malloc(sizeof(PARAMSTORE));
params->start = start;
params->thread = thread;
thread->md.handle = thread->id = (TID) _beginthread(ExcpStartFunc,
- NULL,
- thread->stack->stackSize,
- params);
+ NULL,
+ thread->stack->stackSize,
+ params);
if(thread->md.handle == -1) {
return PR_FAILURE;
}
@@ -232,7 +232,7 @@ _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri)
PR_ASSERT(rv == NO_ERROR);
if (rv != NO_ERROR) {
PR_LOG(_pr_thread_lm, PR_LOG_MIN,
- ("PR_SetThreadPriority: can't set thread priority\n"));
+ ("PR_SetThreadPriority: can't set thread priority\n"));
}
return;
}
@@ -268,41 +268,41 @@ _PR_MD_EXIT(PRIntn status)
}
#ifdef HAVE_THREAD_AFFINITY
-PR_EXTERN(PRInt32)
+PR_EXTERN(PRInt32)
_PR_MD_SETTHREADAFFINITYMASK(PRThread *thread, PRUint32 mask )
{
- /* Can we do this on OS/2? Only on SMP versions? */
- PR_NOT_REACHED("Not implemented");
- return 0;
+ /* Can we do this on OS/2? Only on SMP versions? */
+ PR_NOT_REACHED("Not implemented");
+ return 0;
- /* This is what windows does:
- int rv;
+ /* This is what windows does:
+ int rv;
- rv = SetThreadAffinityMask(thread->md.handle, mask);
+ rv = SetThreadAffinityMask(thread->md.handle, mask);
- return rv?0:-1;
- */
+ return rv?0:-1;
+ */
}
PR_EXTERN(PRInt32)
_PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask)
{
- /* Can we do this on OS/2? Only on SMP versions? */
- PR_NOT_REACHED("Not implemented");
- return 0;
+ /* Can we do this on OS/2? Only on SMP versions? */
+ PR_NOT_REACHED("Not implemented");
+ return 0;
- /* This is what windows does:
- PRInt32 rv, system_mask;
+ /* This is what windows does:
+ PRInt32 rv, system_mask;
- rv = GetProcessAffinityMask(GetCurrentProcess(), mask, &system_mask);
-
- return rv?0:-1;
- */
+ rv = GetProcessAffinityMask(GetCurrentProcess(), mask, &system_mask);
+
+ return rv?0:-1;
+ */
}
#endif /* HAVE_THREAD_AFFINITY */
void
-_PR_MD_SUSPEND_CPU(_PRCPU *cpu)
+_PR_MD_SUSPEND_CPU(_PRCPU *cpu)
{
_PR_MD_SUSPEND_THREAD(cpu->thread);
}
@@ -317,13 +317,13 @@ void
_PR_MD_SUSPEND_THREAD(PRThread *thread)
{
if (_PR_IS_NATIVE_THREAD(thread)) {
- APIRET rc;
+ APIRET rc;
/* XXXMB - DosSuspendThread() is not a blocking call; how do we
* know when the thread is *REALLY* suspended?
*/
- rc = DosSuspendThread(thread->md.handle);
- PR_ASSERT(rc == NO_ERROR);
+ rc = DosSuspendThread(thread->md.handle);
+ PR_ASSERT(rc == NO_ERROR);
}
}