From: Gin Mendi Date: 2009-09-02T13:55:08+09:00 Subject: Problems with cross-thread violation Been having problems with cross-thread violation in my program and been researching on how I can get around it. I really want to continue using ruby, because learning and using it has been fun, but if I can't find some solution I guess I have to drop it for now. Basically I'm using a dll provided by a vendor to access the server to get a live feed of data. I made a module using Ruby/DL to access the function calls like logging on to the server and resquesting a snapshot data or a session of a live feed of data. Everything has been working great except my attempts to establish a live feed. The live feed requires a callback function where the server will call whenever new data is available. This is where I encounter cross-thread violations. I tried simple implementations of requesting a live feed and supplying a callback function using Ruby/DL. I then just have an infinite loop to keep the programming waiting. The callback is performed but after a certain number of calls I get the cross-thread violation on rb_threa_schedule() error. From what I read is this because the callback is initiated in another thread apart from the ruby's main thread? Even if this is the cause, I still have no idea how I can remedy this. I tried using EventMachine hoping that I could pass the pointer from the callback to some spawned process but I eventually got the cross-thread violation. Is there an approach I can use to solve this problem or do I just simply give up and use something else. I'm hoping some of the gurus here can give me some information on what I can do. -- Posted via http://www.ruby-forum.com/.