Fox threading issues

I have a simple program (down below) that causes different failures on
the 1.6.7 MSC build (from RubyCentral) and on Linux with 1.6.7. On
Windows the program just locks up. On Linux (as on cygwin) it runs for a
while and then seg faults. Any ideas anyone?

Steve Tuckner

require "thread"
require “fox”

include Fox

class MainWindow < FXMainWindow
def initialize(app)

Invoke base class initialize first

super(app, “Main Window”, nil, nil, DECOR_ALL, 0, 0, 400, 200)

menubar = FXMenubar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

File Menu

filemenu = FXMenuPane.new(self)
FXMenuCommand.new(filemenu, “&Quit”, nil, getApp(), FXApp::ID_QUIT, 0)
FXMenuTitle.new(menubar, “&File”, nil, filemenu)

label = FXLabel.new(self, "Count: ")
@countLabel = FXLabel.new(self, “0”)

button = FXButton.new(self, “Reset Count”)
button.connect(SEL_COMMAND) do
$count = 0
end
end

def onTimeout(sender, sel, ptr)
$lock.synchronize {
@countLabel.setText($count.to_s)
}
getApp().addTimeout(100, method(:onTimeout))
end

def create
super
show(PLACEMENT_SCREEN)
getApp().addTimeout(100, method(:onTimeout))
end
end

$count = 0
$lock = Mutex.new

w = Thread.new do
loop do
#File.open(“thrd.rb”, “r”) do |f|
#data = f.read
#end

$lock.synchronize {
$count += 1
}
sleep 0
end
end

Make an application

application = FXApp.new(“Dialog”, “FoxTest”)
application.init(ARGV)
MainWindow.new(application)
application.create
application.run