Class: Idb::QtThreadFix

Inherits:
Qt::Object
  • Object
show all
Defined in:
lib/lib/qt_thread_fix.rb

Constant Summary collapse

@@ruby_thread_queue =
Queue.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQtThreadFix

Returns a new instance of QtThreadFix.



8
9
10
11
12
13
14
15
# File 'lib/lib/qt_thread_fix.rb', line 8

def initialize
  super()
  # Enable threading
  @ruby_thread_sleep_period = 0.01
  @ruby_thread_timer = Qt::Timer.new(self)
  connect(@ruby_thread_timer, SIGNAL('timeout()'), SLOT('ruby_thread_timeout()'))
  @ruby_thread_timer.method_missing(:start, 0)
end

Class Method Details

.ruby_thread_queueObject



25
26
27
# File 'lib/lib/qt_thread_fix.rb', line 25

def self.ruby_thread_queue
  @@ruby_thread_queue
end

Instance Method Details

#ruby_thread_timeoutObject



17
18
19
20
21
22
23
# File 'lib/lib/qt_thread_fix.rb', line 17

def ruby_thread_timeout
  unless @@ruby_thread_queue.empty?
    proc_to_call = @@ruby_thread_queue.pop
    proc_to_call.call
  end
  sleep(@ruby_thread_sleep_period)
end