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 #include <setjmp.h>
9 
_MD_EarlyInit(void)10 void _MD_EarlyInit(void)
11 {
12 }
13 
_MD_HomeGCRegisters(PRThread * t,int isCurrent,int * np)14 PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
15 {
16     if (isCurrent) {
17         (void) setjmp(CONTEXT(t));
18     }
19     *np = sizeof(CONTEXT(t)) / sizeof(PRWord);
20     return (PRWord *) CONTEXT(t);
21 }
22 
23 void
_MD_SET_PRIORITY(_MDThread * thread,PRUintn newPri)24 _MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri)
25 {
26     return;
27 }
28 
29 PRStatus
_MD_InitializeThread(PRThread * thread)30 _MD_InitializeThread(PRThread *thread)
31 {
32     return PR_SUCCESS;
33 }
34 
35 PRStatus
_MD_WAIT(PRThread * thread,PRIntervalTime ticks)36 _MD_WAIT(PRThread *thread, PRIntervalTime ticks)
37 {
38     PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
39     _PR_MD_SWITCH_CONTEXT(thread);
40     return PR_SUCCESS;
41 }
42 
43 PRStatus
_MD_WAKEUP_WAITER(PRThread * thread)44 _MD_WAKEUP_WAITER(PRThread *thread)
45 {
46     if (thread) {
47         PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
48     }
49     return PR_SUCCESS;
50 }
51 
52 /* These functions should not be called for Unixware */
53 void
_MD_YIELD(void)54 _MD_YIELD(void)
55 {
56     PR_NOT_REACHED("_MD_YIELD should not be called for Unixware.");
57 }
58 
59 PRStatus
_MD_CREATE_THREAD(PRThread * thread,void (* start)(void *),PRUintn priority,PRThreadScope scope,PRThreadState state,PRUint32 stackSize)60 _MD_CREATE_THREAD(
61     PRThread *thread,
62     void (*start) (void *),
63     PRUintn priority,
64     PRThreadScope scope,
65     PRThreadState state,
66     PRUint32 stackSize)
67 {
68     PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for Unixware.");
69     return PR_FAILURE;
70 }
71