Class List Method List File List

# Class: Thread

Inherits:
  Object
  - Object
  - Thread
  show all
Defined in:
  src/ruby/osx/objc/ruby_addition.rb

## Overview

Thread additions.

## Class Method Summary (collapse)

- + (Object) new(*args, &block)

  Override Thread.new to prevent threads being created if there isn't runtime support for it.

- + (Object) pre_rubycocoa_new

## Class Method Details

### + (`Object`) new(*args, &block)

Override Thread.new to prevent threads being created if there isn't runtime support for it

    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    # File 'src/ruby/osx/objc/ruby_addition.rb', line 128

    def new(*args,&block)
      unless defined? @_rubycocoa_threads_allowed then
        # If user has explicilty disabled thread support, also disable the
        # check (for debugging/testing only)
        @_rubycocoa_threads_allowed = ENV['RUBYCOCOA_THREAD_HOOK_DISABLE'] ||
          OSX::RBRuntime.isRubyThreadingSupported?
      end
      if !@_rubycocoa_threads_allowed then
        warn "#{caller[0]}: Ruby threads cannot be used in RubyCocoa without patches to the Ruby interpreter"
      end
      pre_rubycocoa_new(*args,&block)
    end

### + (`Object`) pre_rubycocoa_new

    124
    # File 'src/ruby/osx/objc/ruby_addition.rb', line 124

    alias :pre_rubycocoa_new :new