suspendInterrupts
Disable or Enable User Interrupts

Description

Evaluates an expression with user interrupts disabled or enabled, and returns the expression's value.

Usage

suspendInterrupts(expr)
allowInterrupts(expr)

Arguments

expr an expression to evaluate. The expression is evaluated in the frame of the caller.

Details

Typing control-C causes a user interrupt an executing computation, which normally stops the executing computation and returns to the top-level console.
suspendInterrupts disables user interrupts while TERR is executing an expression. Any user interrupts are totally ignored, so they do not signal a condition and are not caught by tryCatch.
Within a suspendInterrupts expression, allowInterrupts re-enables user interrupts while executing a subexpression.
Object finalizer functions (see reg.finalizer) are evaluated with user interrupts suspended.
Value
returns the value of the expression.
See Also
tryCatch, reg.finalizer.
Examples
suspendInterrupts({
  print("can't interrupt this loop")
  for(x in 1:10) {print(x);Sys.sleep(1)}
  print("can interrupt this loop")
  allowInterrupts(for(x in 1:10) {print(x);Sys.sleep(1)})
})
Package base version 6.0.0-69
Package Index