Title:

waitThread - a class that encapsulates a timed action. A task can be programmed to be performed after a fixed interval and optionally repeated any number of times every n seconds. This is similar to the sleep function, but the task is evaluated asynchronously so the calling function returns immediately and does not wait for the action to complete or for the duration of the delay.

Slots:

:

Constructors:

new("waitThread")
creates a new thread that is started but contains no tasks in the queue and so is idle. Tasks can be registered with this thread sendTask() and the interval can be set using setInterval
waitThread()
create a waitThread object which performs a given task after a specified interval. Optionally, the task can be automatically rescheduled or the task can reschedule another task. The object created is of class waitThread which inherits from the thread class.

See Also:

thread()
thread

Examples:

      # print a running count, starting at 1,
      # on the standard output connection every minute.
     waitThread(interval=60, Quote(print(i = i + 1)), data=list(i=1),repeat=T)
     #  print a running count 10 times - 1 per minute
     waitThread(interval=rep(60,10),
                  Quote(print(i = i + 1)), data=list(i=1),repeat=T)

      # print a running count.
      # the first after 1 second, the next 2 seconds later
      # the next 4 seconds later, etc.
     waitThread(interval=2^(0:9),
                  Quote(print(i = i + 1)), data=list(i=1),repeat=T)     

Key Words:


Last modified: Fri Feb 7 09:23:28 1997