home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Examples / ThreadedApp-1.0.1 / Counter.h < prev    next >
Encoding:
Text File  |  1997-04-02  |  852 b   |  47 lines

  1. /*
  2.  *  $Id: Counter.h,v 1.1 1997/04/02 18:28:25 croehrig Exp $
  3.  *
  4.  *  Counter:  simple counter object that runs in its own thread.
  5.  */
  6.  
  7. #import <objc/Object.h>
  8. #import "CJRLock.h"
  9.  
  10. @interface Counter : Object
  11. {
  12.     // targets
  13.     id        countField;
  14.     id        intervalField;
  15.     id        slider;
  16.     id        window;
  17.  
  18.     @private
  19.     char    *title;
  20.     int        mynum; 
  21.     volatile int count;
  22.     volatile int interval;
  23.     volatile BOOL running;
  24.     CJRConditionLock *runlock;
  25.  
  26. }
  27.  
  28. // Actions
  29.  
  30. - start:sender;
  31. //  Starts counting (detaches a new thread to count)
  32.  
  33. - stop:sender;
  34. // Stop (pause) the counter (ends the thread)
  35.  
  36. - startOrStop:sender;
  37. // Starts or stops the counter depending on the sender's state 
  38. // (sender should be a Button)
  39.  
  40. - reset:sender;
  41. // resets the counter to zero
  42.  
  43. - setInterval:sender;
  44. // Target for actions that change the count interval
  45.  
  46. @end
  47.