home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / pr / src / md / unix / bsdi.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.2 KB  |  94 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #include "primpl.h"
  20.  
  21. #include <signal.h>
  22.  
  23. void _MD_EarlyInit(void)
  24. {
  25.     /*
  26.      * Ignore FPE because coercion of a NaN to an int causes SIGFPE
  27.      * to be raised.
  28.      */
  29.     struct sigaction act;
  30.  
  31.     act.sa_handler = SIG_IGN;
  32.     sigemptyset(&act.sa_mask);
  33.     act.sa_flags = SA_RESTART;
  34.     sigaction(SIGFPE, &act, 0);
  35. }
  36.  
  37. PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
  38. {
  39.     if (isCurrent) {
  40.     (void) setjmp(CONTEXT(t));
  41.     }
  42.     *np = sizeof(CONTEXT(t)) / sizeof(PRWord);
  43.     return (PRWord *) CONTEXT(t);
  44. }
  45.  
  46. void
  47. _MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri)
  48. {
  49.     return;
  50. }
  51.  
  52. PRStatus
  53. _MD_InitializeThread(PRThread *thread)
  54. {
  55.     return PR_SUCCESS;
  56. }
  57.  
  58. PRStatus
  59. _MD_WAIT(PRThread *thread, PRIntervalTime ticks)
  60. {
  61.     PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
  62.     _PR_MD_SWITCH_CONTEXT(thread);
  63.     return PR_SUCCESS;
  64. }
  65.  
  66. PRStatus
  67. _MD_WAKEUP_WAITER(PRThread *thread)
  68. {
  69.     if (thread) {
  70.     PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
  71.     }
  72.     return PR_SUCCESS;
  73. }
  74.  
  75. /* These functions should not be called for BSDI */
  76. void
  77. _MD_YIELD(void)
  78. {
  79.     PR_NOT_REACHED("_MD_YIELD should not be called for BSDI.");
  80. }
  81.  
  82. PRStatus
  83. _MD_CREATE_THREAD(
  84.     PRThread *thread,
  85.     void (*start) (void *),
  86.     PRThreadPriority priority,
  87.     PRThreadScope scope,
  88.     PRThreadState state,
  89.     PRUint32 stackSize)
  90. {
  91.     PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for BSDI.");
  92.     return PR_FAILURE;
  93. }
  94.