|
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 void _MD_EarlyInit(void) |
|
9 { |
|
10 } |
|
11 |
|
12 PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) |
|
13 { |
|
14 #ifndef _PR_PTHREADS |
|
15 if (isCurrent) { |
|
16 (void) setjmp(CONTEXT(t)); |
|
17 } |
|
18 *np = sizeof(CONTEXT(t)) / sizeof(PRWord); |
|
19 return (PRWord *) CONTEXT(t); |
|
20 #else |
|
21 *np = 0; |
|
22 return NULL; |
|
23 #endif |
|
24 } |
|
25 |
|
26 #ifdef _PR_PTHREADS |
|
27 |
|
28 void _MD_CleanupBeforeExit(void) |
|
29 { |
|
30 } |
|
31 |
|
32 #else /* ! _PR_PTHREADS */ |
|
33 |
|
34 void |
|
35 _MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri) |
|
36 { |
|
37 return; |
|
38 } |
|
39 |
|
40 PRStatus |
|
41 _MD_InitializeThread(PRThread *thread) |
|
42 { |
|
43 /* |
|
44 * set the pointers to the stack-pointer and frame-pointer words in the |
|
45 * context structure; this is for debugging use. |
|
46 */ |
|
47 thread->md.sp = _MD_GET_SP_PTR(thread); |
|
48 thread->md.fp = _MD_GET_FP_PTR(thread); |
|
49 return PR_SUCCESS; |
|
50 } |
|
51 |
|
52 PRStatus |
|
53 _MD_WAIT(PRThread *thread, PRIntervalTime ticks) |
|
54 { |
|
55 PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); |
|
56 _PR_MD_SWITCH_CONTEXT(thread); |
|
57 return PR_SUCCESS; |
|
58 } |
|
59 |
|
60 PRStatus |
|
61 _MD_WAKEUP_WAITER(PRThread *thread) |
|
62 { |
|
63 if (thread) { |
|
64 PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); |
|
65 } |
|
66 return PR_SUCCESS; |
|
67 } |
|
68 |
|
69 /* These functions should not be called for RISC OS */ |
|
70 void |
|
71 _MD_YIELD(void) |
|
72 { |
|
73 PR_NOT_REACHED("_MD_YIELD should not be called for RISC OS."); |
|
74 } |
|
75 |
|
76 PRStatus |
|
77 _MD_CREATE_THREAD( |
|
78 PRThread *thread, |
|
79 void (*start) (void *), |
|
80 PRThreadPriority priority, |
|
81 PRThreadScope scope, |
|
82 PRThreadState state, |
|
83 PRUint32 stackSize) |
|
84 { |
|
85 PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for RISC OS."); |
|
86 return PR_FAILURE; |
|
87 } |
|
88 #endif /* ! _PR_PTHREADS */ |