design pattern for data acquisition in background thread?
design pattern for data acquisition in background thread?
- Subject: design pattern for data acquisition in background thread?
- From: Joe Keenan <email@hidden>
- Date: Fri, 26 Sep 2008 18:37:42 -0400
I have an application that acts as a GUI front end for a network
device. The device has a telnet server, so I'm using a ASyncSocket to
open a connection and talk telnet commands to it. That's all working
fine. The problem is that the UI is totally unresponsive while it's
doing an update, and it's 25 or so round trips to the server (telnet
command/responses) for each update.
Right now, the app controller object sends a message to the device
controller, requesting the value of a specified variable. The device
controller does the telnet command to get it, returns it to the app
controller, and the app controller sends it to the text field. Repeat
25 times for a full update. Slow, and there's no return to the run
loop in there to allow for keyboard or UI events.
I'm looking for suggestions on how to deconstruct this to get the
object talking to the device into another thread so the main window
can take UI events. I'm thinking I can package up the variable
requests into a dictionary so that the device controller can do a
bunch at once. Then the main thread can do all the updates from the
dictionary, which should be quick.
joe
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden