onExit() - set or add an expression block to be evaluated when the thread
exits, either normally (exit()) or abnormally
(e.g.cancel())
Perhaps this should be on.exit and evaluated differently
in the context of a thread rather than a function!
T, the expression is added to the list
of existing expressions to be evaluated on exit of this thread.
If F, the existing expressions are removed from this thread
and replaced by expression
return, should be evaluated differently in the context of a function
and a toplevel expression in a thread. It seems like this should be relatively
trivial and I think it is.
tA = thread(Quote({fit <- "No output"; onExit(Quote(print(fit,"output"))); fit = lm(x,y))})