Re: Efficiently receiving data from an NSTask

2008-07-08 Thread Martin Hairer
Hi all, Right now, I am doing the following instead. In the thread that launched the NSTask (call that the master thread), I poll data from stdout until the task has died: Coming back to the original question: is it legal to have one thread accessing the NSFileHandle bound to the stdout of an

Re: Efficiently receiving data from an NSTask

2008-07-07 Thread Omar Qazi
On Jul 6, 2008, at 7:46 AM, Martin Hairer wrote: This works like a treat and is faster by a factor 3 or so than using the Moriarity implementation. However, it leaves me a bit concerned about various warnings all over the place concerning the thread (un)safety of NSTask and NSFileHandle. So my

Re: Efficiently receiving data from an NSTask

2008-07-07 Thread Andrew Farmer
On 06 Jul 08, at 23:24, Omar Qazi wrote: On Jul 6, 2008, at 7:46 AM, Martin Hairer wrote: This works like a treat and is faster by a factor 3 or so than using the Moriarity implementation. However, it leaves me a bit concerned about various warnings all over the place concerning the thread

Re: Efficiently receiving data from an NSTask

2008-07-07 Thread Michael Ash
On Mon, Jul 7, 2008 at 2:36 AM, Andrew Farmer [EMAIL PROTECTED] wrote: On 06 Jul 08, at 23:24, Omar Qazi wrote: On Jul 6, 2008, at 7:46 AM, Martin Hairer wrote: This works like a treat and is faster by a factor 3 or so than using the Moriarity implementation. However, it leaves me a bit

Re: Efficiently receiving data from an NSTask

2008-07-07 Thread Charles Srstka
On Jul 7, 2008, at 10:16 AM, Michael Ash wrote: 3) Look for a clean break in the UTF-8 sequence. This is not as difficult as it sounds. There are two easy scenarios where you can break. The first is after any ASCII character. You can scan your NSMutableData buffer for any char value = 127, and

Re: Efficiently receiving data from an NSTask

2008-07-07 Thread Michael Ash
On Mon, Jul 7, 2008 at 11:52 AM, Charles Srstka [EMAIL PROTECTED] wrote: On Jul 7, 2008, at 10:16 AM, Michael Ash wrote: 3) Look for a clean break in the UTF-8 sequence. This is not as difficult as it sounds. There are two easy scenarios where you can break. The first is after any ASCII

Re: Efficiently receiving data from an NSTask

2008-07-07 Thread Charles Srstka
On Jul 7, 2008, at 11:04 AM, Michael Ash wrote: Um, no it won't. The mask for the first two bits would be 0xC0, not 0xA. 0xA would be 0101, which other than being the ASCII newline character, doesn't seem terribly interesting for this use. You're right, my bad. I even checked 0xC0 to make

Re: Efficiently receiving data from an NSTask

2008-07-07 Thread Daryle Walker
On Jul 7, 2008, at 11:19 AM, Michael Ash wrote: 3) Look for a clean break in the UTF-8 sequence. This is not as difficult as it sounds. There are two easy scenarios where you can break. The first is after any ASCII character. You can scan your NSMutableData buffer for any char value = 127, and

Efficiently receiving data from an NSTask

2008-07-06 Thread Martin Hairer
Hi, I am in the situation where I want to launch a helper tool, retrieve the data that it dumps to stdout, and monitor the output of stderr for error messages and progress control. I did figure out that the standard way of doing this is along the lines of the Moriarity sample code. The problem is