home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / µSim 1.1 / FabLibsƒ / FabTaskManager.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-03  |  2.4 KB  |  73 lines  |  [TEXT/CWIE]

  1. #pragma internal on
  2.  
  3. // You need to initialize (and cleanup) this manager only
  4. // if you want to use the Timers.
  5. void InitFabTaskManager_OldTimers(void);
  6. void CleanupFabTaskManager_OldTimers(void);
  7.  
  8. /*
  9. theProc is the procedure you want to schedule for execution.
  10. It must be in a LOCKED segment (it should not move, guys).
  11.  
  12. - for System Tasks:
  13. theProc is supposed to move memory; if it does not, call it directly instead of deferring it!
  14.  
  15. - for (new) Timer Tasks:
  16. theProc is called at system task time and thus is not subject to certain limitations;
  17.  
  18. - for (old) Timer Tasks:
  19. theProc is called at interrupt time and thus is subject to well-known limitations;
  20. theProc is supposed not to trash register A3 (68K) because of my implementation.
  21.  
  22. Pass NULL in theProc and the Mac will almost surely HANG.
  23. */
  24.  
  25. // tasks created with autoDestroy run only once and self-destruct
  26. // don't call this at interrupt time!
  27. void *Fab_CreateSystemTask(void (*theProc)(void *), void *param, Boolean autoDestroy);
  28.  
  29. // of course you can do the scheduling at interrupt time
  30. void Fab_ScheduleSystemTask(void *theTaskPtr);
  31.  
  32. // you need to destroy only if you set autoDestroy to false
  33. // don't call this at interrupt time!
  34. void Fab_DestroySystemTask(void *theTaskPtr);
  35.  
  36.  
  37. /** New calls that don't use the Time Manager **/
  38.  
  39. // don't call these at interrupt time!
  40. void *Fab_CreateTimerTask(void (*theProc)(void *), void *param, Boolean autoDestroy);
  41. void Fab_DestroyTimerTask(void *theTaskPtr);
  42.  
  43. // you may call these at interrupt time
  44. #if !GENERATING68K
  45. void Fab_ScheduleTimerTask(void *theTaskPtr, UInt32 millisecs);
  46. void Fab_RescheduleTimerTask(void *theTaskPtr, UInt32 millisecs);
  47. void Fab_CancelTimerTask(void *theTaskPtr);
  48. #else
  49. #pragma parameter Fab_ScheduleTimerTask(__A0,__D0)
  50. asm void Fab_ScheduleTimerTask(void *tPtr, UInt32);
  51. #pragma parameter Fab_RescheduleTimerTask(__A0,__D0)
  52. asm void Fab_RescheduleTimerTask(void *tPtr, UInt32);
  53. #pragma parameter Fab_CancelTimerTask(__A0)
  54. asm void Fab_CancelTimerTask(void *tPtr);
  55. #endif
  56.  
  57.  
  58. /*** Old calls that use the darned Time Manager ***/
  59.  
  60. // don't call these at interrupt time!
  61. void *FabOld_CreateTimerTask(void (*theProc)(void *), void *param);
  62. void FabOld_DestroyTimerTask(void *theTaskPtr);
  63.  
  64. // you may call these at interrupt time
  65. void FabOld_ScheduleTimerTask(void *theTaskPtr, long millisecs);
  66. void FabOld_CancelTimerTask(void *theTaskPtr);
  67.  
  68. // call this at idle time -- of course not at interrupt time!
  69. void CheckCallQueue(void);
  70.  
  71. #pragma internal reset
  72.  
  73.