From: Gin Mendi Date: 2009-09-03T11:08:32+09:00 Subject: Re: Problems with cross-thread violation Eleanor McHugh wrote: > On 2 Sep 2009, at 05:55, Gin Mendi wrote: >> 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. > > Do you have code available that we can study? Thanks again for taking the time to read this! require 'feed_library' # my callback for the live feed FEED_CALLBACK = DL.callback('0PL') { |result_list, count| } if result_list record = FeedRecord.new(result_list) puts record.code end } # handle used to request for a feed handle = FeedLibrary::log_on("user", "password") session = get_live_feed(handle, FEED_CALLBACK) # my attempt to keep this running and waiting on the callback: while true end Here's one I tried. Been playing around with different approaches. With this method I noticed I always get the cross-thread violation when I use the FeedRecord structure. If I don't use the structure and do something else like using the struct! method I'm able to get away with the callback being performed a couple of times then it eventually leads to a cross-thread violation. -- Posted via http://www.ruby-forum.com/.