1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #include "primpl.h"
7 
8 /*
9  * using only NSPR threads here
10  *
11  *  Copied from the UnixWare implementation.  Should be kept in sync
12  *  with ../../../include/md/_dgux.h.
13  */
14 
15 #include <setjmp.h>
16 
_MD_EarlyInit(void)17 void _MD_EarlyInit(void)
18 {
19 }
20 
_MD_HomeGCRegisters(PRThread * t,int isCurrent,int * np)21 PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
22 {
23     if (isCurrent) {
24         (void) setjmp(CONTEXT(t));
25     }
26     *np = sizeof(CONTEXT(t)) / sizeof(PRWord);
27     return (PRWord *) CONTEXT(t);
28 }
29 
30 void
_MD_SET_PRIORITY(_MDThread * thread,PRUintn newPri)31 _MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri)
32 {
33     return;
34 }
35 
36 PRStatus
_MD_InitializeThread(PRThread * thread)37 _MD_InitializeThread(PRThread *thread)
38 {
39     return PR_SUCCESS;
40 }
41 
42 PRStatus
_MD_WAIT(PRThread * thread,PRIntervalTime ticks)43 _MD_WAIT(PRThread *thread, PRIntervalTime ticks)
44 {
45     PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
46     _PR_MD_SWITCH_CONTEXT(thread);
47     return PR_SUCCESS;
48 }
49 
50 PRStatus
_MD_WAKEUP_WAITER(PRThread * thread)51 _MD_WAKEUP_WAITER(PRThread *thread)
52 {
53     if (thread) {
54         PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
55     }
56     return PR_SUCCESS;
57 }
58 
59 /* These functions should not be called for DG/UX */
60 void
_MD_YIELD(void)61 _MD_YIELD(void)
62 {
63     PR_NOT_REACHED("_MD_YIELD should not be called for DG/UX.");
64 }
65 
66 PRStatus
_MD_CREATE_THREAD(PRThread * thread,void (* start)(void *),PRThreadPriority priority,PRThreadScope scope,PRThreadState state,PRUint32 stackSize)67 _MD_CREATE_THREAD(
68     PRThread *thread,
69     void (*start) (void *),
70     PRThreadPriority priority,
71     PRThreadScope scope,
72     PRThreadState state,
73     PRUint32 stackSize)
74 {
75     PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for DG/UX.");
76 }
77 
78