discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RunLoop vs Thread ?


From: Richard Frith-Macdonald
Subject: Re: RunLoop vs Thread ?
Date: Tue, 20 May 2003 10:10:23 +0100


On Monday, May 19, 2003, at 07:59  pm, Yen-Ju Chen wrote:

Hi,

 Does it have more advantage to using RunLoop than Thread
 in terms of non-blocking user interface ?
Some tasks in CodeEditor take about 2-3 seconds depending on the file size,
 which block the user input and is annoying.
Would it be better to implement these kinds task into RunLoop than Thread ?
 I feel thread is more difficult to debug
 and need to be careful when coupled with GUI component.
 But I never touch RunLoop before and am not sure it is suitable.

NSRunLoop is good if your tasks can be divided into portions each taking a small fraction of a second and either handled in response to a timeout or to I/O completion.

I agree that it's usually best to avoid threads if you can, but if your tasks are time consuming and can't readily be divided up, you may be stuck with using threads.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]