John:
This differs little from your description on page 11 of event.ps. I don't think we should allow the user to have a thread argument that can make the call refer to self(). This is what sleep is for. I can see the consistency argument, but the name suggests something different. We would have objects of class waitThread and a function that didn't necessarily create one! It is not a big deal, but it seems more intuitive to keep sleep() as sleep and this to do things asynchronously. Also, if the target thread is self(), we could just do
   sleep(interval)
   x = lm(x,y)
rather than
    waitThread(interval, Quote(x = lm(x,y)))
This is a small point, but it seems more intuitive to not have Quote in there.
Also, it might be better to hide the word Thread unless multiple threads are in existence. For example

Title:

waitThread - create a waitThread object which performs a 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.

Usage:

waitThread( interval, expression, repeat=F , name="", parent=NULL, start=T, group=NULL, priority=1, detach=F, access=F, onExit = NULL, input=NULL, output=NULL, error=NULL, attributes= threadAttributes(), toplevel=NULL, data=NULL, action=standardEval )
Note that many of the arguments are document from the thread() documentation since this class (waitThread) inherits from class thread.

Arguments:

expression:
the expression that will be evaluated when the timer expires. This is any expression and the search path is as usual for newly created thread objects.
interval:
the number of seconds to wait until the timer expires. At the end of this time (approximately), the thread will evaluate expression. If this length of this object is greater than 1 and is of mode numeric the values are treated as successive intervals between repeated evaluations of the same action/task supplied in expression. This allows the user to repeat a task a given number of times with different intervals between each iteration. See also the repeat argument for more details.
repeat:
this can be specified either as a numeric value denoting an interval or as a logical value.
  • logical - if true, automatically reschedule the expression to be evaluated every interval seconds. If the value is false, the expression is evaluated once. The expression can call rewaitThread().
  • numeric value - this is interpreted as the delay to use between successive evaluations of expression. The timer is automatically rescheduled each time to expire after this length of time.
    If the argument interval is missing and repeat is specified as a numeric value, this is also used for the initial interval.
  • I am not sure we want to do this, but semantically it is ok!
    list of numeric values - the thread reschedules expression to be evaluated this number of times. The interval between the ith and (i+1)th evaluation is the ith vaue in the list.
    Again, if interval is not supplied and this is, this is used for scheduling in what I think is the obvious way. (i.e. the first time it goes off is after repeat[[1]] seconds, and then repeat[[2]] seconds, etc.)
access:
See access for a description of the purpose of this argument. Note that, by default, we allow no other thread to have tasks evaluated by this thread through sendTask.html.

Side Effect:

A thread is created and managed by the evaluator manager.

See Also:

Examples:


Key Words:


Last modified: Mon Feb 10 16:37:14 1997