delegate

NSThread with a delegate? Impossible? A Better way?

adamfenn28's picture

I want to launch a daemon on new thread, to my program doesn't lock up while waiting for input from the daemon, but I need a way for the main program to get information back from the daemon. I've used NSThread to fire off a new thread, but I don't see how to use a delegate with NSThread.

For more context, I'm working on a custom patch for that will receive data from the network. Specifically, multicast with via a externally configurable address and port, without 32 byte characters. The idea is that a second thread could run the daemon, and on each frame, I'd grab the new data from an ivar set by a delegate method when the daemon thread received new data.. all the while, the composition runs along with no interruption.

Can I do this with NSThread? Is there a better way I should be looking at?