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

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