home *** CD-ROM | disk | FTP | other *** search
/ Really Useful CD 1 / ReallyUsefulCD1.iso / extras / languages / smalltalk / _smalltalk / sources / h / process < prev    next >
Encoding:
Text File  |  1987-12-30  |  1.3 KB  |  52 lines

  1. /*
  2.      Little Smalltalk
  3.  
  4.           process definitions
  5.           dennis a. vadner and michael t. benhase,  11/84
  6. */
  7. /*
  8.      the process
  9.  
  10.           interp = pointer to the head of the process'
  11.                 interpreter chain
  12.           p_state = current state of the process
  13.  
  14.           next = link to the next process in the active list
  15.           prev = link to the previous process in the active list
  16. */
  17.  
  18.  
  19. struct  process_struct {
  20.      int       p_ref_count;
  21.      int       p_size;
  22.      interpreter    *interp;
  23.      int       p_state;
  24.      struct process_struct  *next;
  25.      struct process_struct  *prev;
  26.      } ;
  27.  
  28. typedef  struct process_struct  process;
  29.  
  30. extern int  atomcnt;               /* atomic action flag */
  31. extern process  *runningProcess;   /* currently running process */
  32.  
  33. extern process  *cr_process();          /* create a new process */
  34. extern int  set_state();      /* set the state on a process */
  35.  
  36.  
  37. /* process states */
  38.  
  39. # define  ACTIVE    0
  40. # define  SUSPENDED 1
  41. # define  READY          ~SUSPENDED
  42. # define  BLOCKED   2
  43. # define  UNBLOCKED ~BLOCKED
  44. # define  TERMINATED     4
  45.  
  46. # define  CUR_STATE 10
  47.  
  48.  
  49. # define  terminate_process(aProcess)  {set_state(aProcess, TERMINATED); \
  50.                          if (aProcess == runningProcess)  \
  51.                              atomcnt = 0;}
  52.