home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / microcode / os2thrd.h < prev    next >
C/C++ Source or Header  |  1999-01-02  |  3KB  |  90 lines

  1. /* -*-C-*-
  2.  
  3. $Id: os2thrd.h,v 1.4 1999/01/02 06:11:34 cph Exp $
  4.  
  5. Copyright (c) 1994-1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. #ifndef SCM_OS2THRD_H
  23. #define SCM_OS2THRD_H
  24.  
  25. typedef void (* thread_procedure_t) (void *);
  26. typedef void (* error_hook_t) (msg_t *);
  27.  
  28. typedef struct
  29. {
  30.   error_hook_t error_hook;
  31.   jmp_buf error_restart;
  32.   PEXCEPTIONREGISTRATIONRECORD exception_handler;
  33.   qid_t error_queue;
  34.   char fatal_error_buffer [1024];
  35. } thread_store_t;
  36. #define THREAD_ERROR_HOOK() ((* (OS2_threadstore ())) -> error_hook)
  37. #define THREAD_ERROR_RESTART() ((* (OS2_threadstore ())) -> error_restart)
  38. #define THREAD_ERROR_QUEUE() ((* (OS2_threadstore ())) -> error_queue)
  39. #define THREAD_FATAL_ERROR_BUFFER()                    \
  40.   ((* (OS2_threadstore ())) -> fatal_error_buffer)
  41. #define THREAD_EXCEPTION_HANDLER()                    \
  42.   ((* (OS2_threadstore ())) -> exception_handler)
  43.  
  44. typedef struct
  45. {
  46.   DECLARE_MSG_HEADER_FIELDS;
  47.   int code;
  48.   enum syscall_names name;
  49. } sm_syscall_error_t;
  50. #define SM_SYSCALL_ERROR_CODE(m) (((sm_syscall_error_t *) (m)) -> code)
  51. #define SM_SYSCALL_ERROR_NAME(m) (((sm_syscall_error_t *) (m)) -> name)
  52.  
  53. typedef struct
  54. {
  55.   DECLARE_MSG_HEADER_FIELDS;
  56.   long code;
  57. } sm_error_t;
  58. #define SM_ERROR_CODE(m) (((sm_error_t *) (m)) -> code)
  59.  
  60. typedef msg_t sm_kill_request_t;
  61. #define OS2_make_kill_request() OS2_create_message (mt_kill_request)
  62.  
  63. extern TID  OS2_beginthread (thread_procedure_t, void *, unsigned int);
  64. extern void OS2_endthread (void);
  65. extern void OS2_kill_thread (TID);
  66. extern TID  OS2_current_tid (void);
  67.  
  68. #ifdef __IBMC__
  69. #define OS2_threadstore() ((thread_store_t **) (_threadstore ()))
  70. #else
  71. extern thread_store_t ** OS2_threadstore (void);
  72. #endif
  73.  
  74. extern PID OS2_scheme_pid;
  75. extern TID OS2_scheme_tid;
  76.  
  77. extern int  OS2_thread_initialize (PEXCEPTIONREGISTRATIONRECORD, qid_t);
  78. extern int  OS2_thread_initialize_1 (PEXCEPTIONREGISTRATIONRECORD, qid_t);
  79. extern int  OS2_error_message_p (msg_t *);
  80. extern void OS2_handle_error_message (msg_t *);
  81. extern void OS2_ignore_errors (void);
  82. extern void OS2_error_system_call (int, enum syscall_names);
  83. extern void OS2_error_anonymous (void);
  84. extern void OS2_error_unimplemented_primitive (void);
  85. extern void OS2_error_out_of_channels (void);
  86. extern msg_t * OS2_make_syscall_error (int, enum syscall_names);
  87. extern msg_t * OS2_make_error (long);
  88.  
  89. #endif /* SCM_OS2THRD_H */
  90.