Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-25 Thread Uli Kusterer
Am 25.07.2009 um 03:27 schrieb Graham Cox: Display a modal progress window which tells the user's what's going on, show an indeterminate progress bar and include a "Stop" button. The worker code can wait on the alias being resolved and the main thread can keep the user informed. By using a m

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Ken Thomases
On Jul 24, 2009, at 4:50 PM, Jerry Krinock wrote: On 2009 Jul 23, at 17:44, Ken Thomases wrote: On Jul 23, 2009, at 6:44 PM, Jerry Krinock wrote: I'd often like to block the main thread First question is: why? Blocking the main thread is usually bad and to be avoided. What are you actu

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Ken Thomases
On Jul 24, 2009, at 5:10 PM, Dave Keck wrote: The notifications don't cross threads; they are delivered in the thread where they are posted. Yes, I understand that. There must be some quirk that allows it to work when doing an NSTask Just a tidbit - I don't think there's any quirks inv

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Graham Cox
On 25/07/2009, at 7:50 AM, Jerry Krinock wrote: First question is: why? Blocking the main thread is usually bad and to be avoided. What are you actually trying to achieve? Can you give an example of when that would be desirable? This happens any time that a user action absolutely requir

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Charles Srstka
On Jul 24, 2009, at 5:10 PM, Dave Keck wrote: The notifications don't cross threads; they are delivered in the thread where they are posted. Yes, I understand that. There must be some quirk that allows it to work when doing an NSTask Just a tidbit - I don't think there's any quirks inv

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Dave Keck
>> The notifications don't cross threads; they are delivered in the thread >> where they are posted. > > Yes, I understand that.  There must be some quirk that allows it to work > when doing an NSTask Just a tidbit - I don't think there's any quirks involved. The general idea is this: NSTask creat

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Jerry Krinock
On 2009 Jul 23, at 17:44, Ken Thomases wrote: On Jul 23, 2009, at 6:44 PM, Jerry Krinock wrote: I'd often like to block the main thread First question is: why? Blocking the main thread is usually bad and to be avoided. What are you actually trying to achieve? Can you give an example

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Dave Camp
On Jul 23, 2009, at 4:44 PM, Jerry Krinock wrote: I'd often like to block the main thread while another thread or process performs a little task, but subject to a short timeout. A few weeks ago, I was able to achieve this by "running" the main thread's run loop while an NSTask completed.

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-23 Thread Jerry Krinock
On 2009 Jul 23, at 17:44, Ken Thomases wrote: Do consider NSConditionLock as an alternative, though. It's likely to be much simpler and more straightforward. Indeed Ken is correct. I'll post the code tomorrow. ___ Cocoa-dev mailing list (Cocoa-de

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-23 Thread Ken Thomases
On Jul 23, 2009, at 6:44 PM, Jerry Krinock wrote: I'd often like to block the main thread First question is: why? Blocking the main thread is usually bad and to be avoided. What are you actually trying to achieve? Can you give an example of when that would be desirable? while another

Challenge: Block Main Thread while Work is done, with Timeout

2009-07-23 Thread Jerry Krinock
I'd often like to block the main thread while another thread or process performs a little task, but subject to a short timeout. A few weeks ago, I was able to achieve this by "running" the main thread's run loop while an NSTask completed. But I did this after hours of experimenting and st