engine-alpha-osf1.h
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:3k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /* ==== machdep.h ============================================================
  2.  * Copyright (c) 1994 Chris Provenzano (proven@athena.mit.edu) and
  3.  * Ken Raeburn (raeburn@mit.edu).
  4.  *
  5.  * $Id$
  6.  *
  7.  */
  8. #ifndef sigwait
  9. #define sigwait __bogus_osf1_sigwait
  10. #endif
  11. #include <unistd.h>
  12. #include <setjmp.h>
  13. #include <sys/time.h>
  14. #include <sys/cdefs.h>
  15. #undef sigwait
  16. /* The first machine dependent functions are the SEMAPHORES needing
  17.    the test and set instruction.
  18.    On the Alpha, the actual values here are irrelevant; they just have
  19.    to be different.  */
  20. #define SEMAPHORE_CLEAR 0
  21. #define SEMAPHORE_SET   1
  22. #if 0
  23. #define SEMAPHORE_TEST_AND_SET(lock)    
  24. ({ int *_sem_lock = (lock), locked, old;
  25.    asm ("mb" : : : "memory");
  26.    do { asm ("ldl_l %0,%1" : "=r" (old) : "m" (*_sem_lock));
  27. /* ?? if (old != SEMAPHORE_CLEAR) break; */
  28. asm ("stl_c %0,%1" : "=r" (locked), "=m" (*_sem_lock)
  29.    : "0" (SEMAPHORE_SET));
  30.    } while (!locked);
  31.    asm ("mb" : : : "memory");
  32.    old == SEMAPHORE_CLEAR; })
  33. #define SEMAPHORE_RESET(lock)           
  34. ({ int *_sem_lock = (lock);
  35.    *_sem_lock = SEMAPHORE_CLEAR;
  36.    asm ("mb" : : : "memory"); })
  37. #endif
  38. /*
  39.  * New types
  40.  */
  41. typedef int semaphore;
  42. /*
  43.  * sigset_t macros
  44.  */
  45. #define SIG_ANY(sig) (sig)
  46. /*
  47.  * New Strutures
  48.  */
  49. struct machdep_pthread {
  50.     void         *(*start_routine)(void *);
  51.     void         *start_argument;
  52.     void         *machdep_stack;
  53.     struct itimerval machdep_timer;
  54.     jmp_buf      machdep_state;
  55. };
  56. /*
  57.  * Static machdep_pthread initialization values.
  58.  * For initial thread only.
  59.  */
  60. #define MACHDEP_PTHREAD_INIT    
  61. { NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 }
  62. /*
  63.  * Minimum stack size
  64.  */
  65. #define PTHREAD_STACK_MIN 2048
  66. /*
  67.  * Some fd flag defines that are necessary to distinguish between posix
  68.  * behavior and bsd4.3 behavior.
  69.  */
  70. #define __FD_NONBLOCK  O_NONBLOCK
  71. /*
  72.  * New functions
  73.  */
  74. __BEGIN_DECLS
  75. #if defined(PTHREAD_KERNEL)
  76. #define __machdep_stack_get(x)      (x)->machdep_stack
  77. #define __machdep_stack_set(x, y)   (x)->machdep_stack = y
  78. #define __machdep_stack_repl(x, y)                          
  79. {                                                           
  80.     if (stack = __machdep_stack_get(x)) {                   
  81.         __machdep_stack_free(stack);                        
  82.     }                                                       
  83.     __machdep_stack_set(x, y);                              
  84. }
  85. void *  __machdep_stack_alloc       __P_((size_t));
  86. void    __machdep_stack_free        __P_((void *));
  87. int machdep_save_state      __P_((void));
  88. #endif
  89. __END_DECLS