Example #1
0
  /**
   * This is intended to be used to raise exceptions in Ruby threads from non- Ruby threads like
   * Timeout's thread.
   *
   * @param args Same args as for Thread#raise
   * @param block Same as for Thread#raise
   */
  public void internalRaise(IRubyObject[] args) {
    Ruby runtime = getRuntime();

    IRubyObject exception = prepareRaiseException(runtime, args, Block.NULL_BLOCK);

    receiveMail(new ThreadService.Event(this, this, ThreadService.Event.Type.RAISE, exception));
  }
 /**
  * Used for finalizers that need to kill a Ruby thread. Finalizers run in a VM thread to which we
  * do not want to attach a ThreadContext and within which we do not want to check for Ruby thread
  * events. This mechanism goes directly to mail delivery, bypassing all Ruby Thread-related steps.
  */
 public void dieFromFinalizer() {
   receiveMail(new ThreadService.Event(null, this, ThreadService.Event.Type.KILL));
 }