COREPROC.DEF 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. (* Release 3.10 *)
  2. (*-------------------------------------------------------------------------*
  3. * *
  4. * COREPROC.DEF - Modula-2 interface to COREPROC.A *
  5. * *
  6. * COPYRIGHT (C) 1989..1992 Clarion Software Corporation. *
  7. * All Rights Reserved *
  8. * *
  9. *--------------------------------------------------------------------------*)
  10. (*# call(o_a_size => off,
  11. o_a_copy=>off,
  12. c_conv=>on,
  13. result_optional=>on) *)
  14. (*# module(implementation=>off, init_code => off) *)
  15. (*# name(prefix => c) *)
  16. DEFINITION MODULE CoreProc;
  17. IMPORT SYSTEM;
  18. TYPE
  19. StackHandle = CARDINAL;
  20. StackHandlePtr = POINTER TO StackHandle;
  21. Task = POINTER TO TaskDescriptor;
  22. TaskDescriptor = RECORD
  23. next : Task; (* queue of waiting Process *)
  24. priority : CARDINAL; (* NB = actual priority+1 *)
  25. cor : SYSTEM.PROCESS;
  26. due : CARDINAL;
  27. wsp : ADDRESS;
  28. wspsize : CARDINAL;
  29. nextdue : Task;
  30. END;
  31. (*# save *)
  32. (*# call(near_call=>off) *)
  33. ThreadProc = PROCEDURE(FarADDRESS);
  34. (*# restore *)
  35. (*# save *)
  36. (*# call(near_call=>off, c_conv=>off) *)
  37. ProcessProcType = PROCEDURE;
  38. (*# restore *)
  39. DelayProcType = PROCEDURE(CARDINAL);
  40. CONST
  41. MaxProcess = 32;
  42. VAR
  43. (*# save *)
  44. (*# data(volatile => on) *)
  45. _ProcIds : ARRAY [0..MaxProcess] OF CARDINAL;
  46. _LastProc : [0..MaxProcess];
  47. _Started : BOOLEAN;
  48. _LockSem : LONGCARD;
  49. _LockCount : CARDINAL;
  50. _LockedThread : CARDINAL;
  51. _core_lock : ProcessProcType;
  52. _core_unlock : ProcessProcType;
  53. _core_delay : DelayProcType;
  54. _exit_proc : ProcessProcType;
  55. _SchedProc : SYSTEM.PROCESS;
  56. _Continue : ProcessProcType;
  57. _proc_init : BOOLEAN;
  58. Stop : BOOLEAN;
  59. _LockNestMonster : CARDINAL;
  60. _SchedTime : CARDINAL;
  61. _NextThread : CARDINAL;
  62. _cp: Task; (* currently active task + ready queue *)
  63. _dq: Task; (* queue of delayed tasks *)
  64. _wq: Task; (* queue of tasks that have reached thier delay time
  65. but haven't been placed on the ready queue *)
  66. _SchedStack: ADDRESS;
  67. (*# restore *)
  68. PROCEDURE _beginthread(P: ThreadProc; Stack: FarADDRESS; Size: CARDINAL;
  69. Arg: FarADDRESS);
  70. PROCEDURE _endthread();
  71. PROCEDURE _getTID(): CARDINAL;
  72. PROCEDURE getpid(): CARDINAL;
  73. PROCEDURE _dosbeginthread(P: PROC; Stlen: CARDINAL; Stkvar: StackHandlePtr): CARDINAL;
  74. PROCEDURE _dosendthread();
  75. PROCEDURE _dosfreestack(Stack: StackHandle);
  76. END CoreProc.
  77.