michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "primpl.h" michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: void _MD_EarlyInit(void) michael@0: { michael@0: /* michael@0: * Ignore FPE because coercion of a NaN to an int causes SIGFPE michael@0: * to be raised. michael@0: */ michael@0: struct sigaction act; michael@0: michael@0: act.sa_handler = SIG_IGN; michael@0: sigemptyset(&act.sa_mask); michael@0: act.sa_flags = SA_RESTART; michael@0: sigaction(SIGFPE, &act, 0); michael@0: } michael@0: michael@0: PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) michael@0: { michael@0: #ifndef _PR_PTHREADS michael@0: if (isCurrent) { michael@0: (void) sigsetjmp(CONTEXT(t), 1); michael@0: } michael@0: *np = sizeof(CONTEXT(t)) / sizeof(PRWord); michael@0: return (PRWord *) CONTEXT(t); michael@0: #else michael@0: *np = 0; michael@0: return NULL; michael@0: #endif michael@0: } michael@0: michael@0: #ifndef _PR_PTHREADS michael@0: void michael@0: _MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri) michael@0: { michael@0: return; michael@0: } michael@0: michael@0: PRStatus michael@0: _MD_InitializeThread(PRThread *thread) michael@0: { michael@0: return PR_SUCCESS; michael@0: } michael@0: michael@0: PRStatus michael@0: _MD_WAIT(PRThread *thread, PRIntervalTime ticks) michael@0: { michael@0: PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); michael@0: _PR_MD_SWITCH_CONTEXT(thread); michael@0: return PR_SUCCESS; michael@0: } michael@0: michael@0: PRStatus michael@0: _MD_WAKEUP_WAITER(PRThread *thread) michael@0: { michael@0: if (thread) { michael@0: PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); michael@0: } michael@0: return PR_SUCCESS; michael@0: } michael@0: michael@0: /* These functions should not be called for NetBSD */ michael@0: void michael@0: _MD_YIELD(void) michael@0: { michael@0: PR_NOT_REACHED("_MD_YIELD should not be called for NetBSD."); michael@0: } michael@0: michael@0: PRStatus michael@0: _MD_CREATE_THREAD( michael@0: PRThread *thread, michael@0: void (*start) (void *), michael@0: PRThreadPriority priority, michael@0: PRThreadScope scope, michael@0: PRThreadState state, michael@0: PRUint32 stackSize) michael@0: { michael@0: PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for NetBSD."); michael@0: return PR_FAILURE; michael@0: } michael@0: #endif /* ! _PR_PTHREADS */