Can NSTask safely be used outside the main thread?

Posted by neoneye on Stack Overflow See other posts from Stack Overflow or by neoneye
Published on 2010-06-12T19:37:37Z Indexed on 2010/06/12 19:42 UTC
Read the original article Hit count: 298

Filed under:
|
|
|

Yesterday I read somewhere that NSTask isn't thread safe and that bothers me a lot, because I'm running a NSTask within a NSThread and is so far not experiencing any threading issues with it.

My code is organized like this

A: main thread -> B: worker thread -> C: worker task

C: The worker task is a commandline program.
B: The worker thread can start/stop the worker task and send it commands.
A: The main thread can send commands to the worker thread.

If NSTask is supposed to be used only within the main thread, then I'm considering moving the NSTask start/stop code to the main thread, just to prevent possible threading issues.

Can NSTask be used outside the main thread?

And if not then what may be the threading issues with NSTask?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about thread-safety