
Untitled
By: a guest on
May 25th, 2012 | syntax:
None | size: 0.99 KB | hits: 11 | expires: Never
#getting no exceptions from this, but I don't see "TESTING" in terminal
class InterruptEvent < Wx::CommandEvent
INTERRUPT_EVENT = Wx::EvtHandler.register_class(self, nil, "doInterruptEvent", 1)
def initialize(*args)
end
def doInterruptEvent
garbage_var = 0
puts "TESTING" #Doesn't show in terminal
end
end
class MainApp < Wx::App
def on_init
# self.gc_stress(100) # Force garbage collector to run ten times a second.
$mutex.synchronize {
$interruptEvent = InterruptEvent.new
$loginFrame = LoginFrame.new
$loginFrame.show
}
end
end
def startUpLoginApp
Thread.start() do
begin
$theMainApp = MainApp.new
Thread.start() do
sleep 3
loop {
sleep 0.05
Wx::EvtHandler.add_pending_event(INTERRUPT_EVENT)
}
end
$theMainApp.main_loop
rescue => e
puts "EXCEPTION (WxApp Thread): "
puts "#{e.backtrace.delete_at(0)}: #{e} (#{e.class})"
e.backtrace.each do |line|; puts line; end
sleep 10
end
end
end