cvsuser     03/07/15 05:32:27

  Modified:    .        MANIFEST
  Added:       classes  timer.pmc
  Log:
  proposal for Timer class
  
  Revision  Changes    Path
  1.376     +1 -0      parrot/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST,v
  retrieving revision 1.375
  retrieving revision 1.376
  diff -u -w -r1.375 -r1.376
  --- MANIFEST  14 Jul 2003 11:50:27 -0000      1.375
  +++ MANIFEST  15 Jul 2003 12:32:22 -0000      1.376
  @@ -56,6 +56,7 @@
   classes/scalar.pmc                                []
   classes/scratchpad.pmc                            []
   classes/sub.pmc                                   []
  +classes/timer.pmc                                 []
   classes/unmanagedstruct.pmc                       []
   config/auto/alignptrs.pl                          []
   config/auto/alignptrs/test_c.in                   []
  
  
  
  1.1                  parrot/classes/timer.pmc
  
  Index: timer.pmc
  ===================================================================
  /* timer.pmc
   *  Copyright: 2002-2003 Yet Another Society
   *  CVS Info
   *     $Id: timer.pmc,v 1.1 2003/07/15 12:32:27 leo Exp $
   *  Overview:
   *     This is the Timer base class
   *  Data Structure and Algorithms:
   *     Running timers are kept in a linked list. Each timer has a
   *     tick count, which gets decremented, if the system timer
   *     expires. If the tick count reaches zero, the timer handler gets
   *     invoked via Parrots event handling code.
   *  History:
   *     Initial proposal by leo 2003.07.15
   *  Synopsis:
   *     new P0, .Timer
   *     set P0[.TIMER_SEC], I_seconds            # whole seconds
   *     set P0[.TIMER_USEC], I_micro seconds     # and/or micro seconds
   *     set P0[.TIMER_NSEC], N_seconds_frac      # or fraction in seconds
   *     set P0[.TIMER_REPEAT], I_repeat          # 0 = one shot ...
   *     set_addr I0, _subroutine
   *     set P0, I0                               # set timer handler sub
   *     invoke P0                                # start timer
   *     set P0[.TIMER_RUNNING], 1                # same
   *
   *     set I0, P0[.TIMER_SEC]                   # query current timer status
   *     set N0, P0[.TIMER_NSEC]
   *     ...
   *     set P0[.TIMER_RUNNING], 0                # turn timer off
   *
   *  Notes:
   *     The Timer resolution is operating system dependend. Its only
   *     guaranteed, that the Timer will fire some time after the
   *     programmed interval.
   *     The Timer stops after (repeat+1) times invoking the handler.
   *     If a Timer should run forever, set "repeat" to -1.
   *     Turning the Timer off sets all values to zero, the Timer is
   *     not destroyed, it can be reprogrammed and started again.
   *
   *  References:
   */
  
  #include "parrot/parrot.h"
  #include "parrot/method_util.h"
  
  pmclass Timer {
  
      STRING* name() {
          return whoami;
      }
  }
  
  
  

Reply via email to