Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
6 #include "primpl.h"
8 #include <signal.h>
10 void _MD_EarlyInit(void)
11 {
12 /*
13 * Ignore FPE because coercion of a NaN to an int causes SIGFPE
14 * to be raised.
15 */
16 struct sigaction act;
18 act.sa_handler = SIG_IGN;
19 sigemptyset(&act.sa_mask);
20 act.sa_flags = SA_RESTART;
21 sigaction(SIGFPE, &act, 0);
22 }
24 PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
25 {
26 #ifndef _PR_PTHREADS
27 if (isCurrent) {
28 (void) sigsetjmp(CONTEXT(t), 1);
29 }
30 *np = sizeof(CONTEXT(t)) / sizeof(PRWord);
31 return (PRWord *) CONTEXT(t);
32 #else
33 *np = 0;
34 return NULL;
35 #endif
36 }
38 #ifndef _PR_PTHREADS
39 void
40 _MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri)
41 {
42 return;
43 }
45 PRStatus
46 _MD_InitializeThread(PRThread *thread)
47 {
48 return PR_SUCCESS;
49 }
51 PRStatus
52 _MD_WAIT(PRThread *thread, PRIntervalTime ticks)
53 {
54 PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
55 _PR_MD_SWITCH_CONTEXT(thread);
56 return PR_SUCCESS;
57 }
59 PRStatus
60 _MD_WAKEUP_WAITER(PRThread *thread)
61 {
62 if (thread) {
63 PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
64 }
65 return PR_SUCCESS;
66 }
68 /* These functions should not be called for FreeBSD */
69 void
70 _MD_YIELD(void)
71 {
72 PR_NOT_REACHED("_MD_YIELD should not be called for FreeBSD.");
73 }
75 PRStatus
76 _MD_CREATE_THREAD(
77 PRThread *thread,
78 void (*start) (void *),
79 PRThreadPriority priority,
80 PRThreadScope scope,
81 PRThreadState state,
82 PRUint32 stackSize)
83 {
84 PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for FreeBSD.");
85 return PR_FAILURE;
86 }
87 #endif /* ! _PR_PTHREADS */