Hello I have an application that transforms a very big file, and during that operation i want to give a chance to user to press Esc and cancel this transformation. Therefore i need to make mainRunLoop run inbetween some "phases" of the file transformation. There's an idea to create a separate "fileprocessing" thread that will do onmly one job - transformation of that file, while the main thread (that has the mainRunLoop) will only watch keypresses and when it detects Esc, it kills that "fileprocessing" thread (or something like that).
I am wondering if i could do that "in one thread", i.e. inbetween transformation phases (for example, each phase - is a transformation of 1 Kb of text) i call [mainRunLoop run], and the mainRunLoop processes the event queue, and then gets back to work - continues processing, if no Esc has been detected. Here's what i can't understand: a call of [mainRunLoop run] will never return, because what i do - is launch of infinite loop. I've been adviced to use [runUntilDate], but i can't know how much time will it be needed to process the whole event queue. If i specify a little (say, [NSDate dateWithTimeIntervalSinceNow:0.001]), it may not be sufficient. If i specify a lot (like, 1 sec) - it's just a waste of processing time. If i specify [NSDate date] it seems like the queue isn't processed at all... Can i make a runloop run only one time through the queue, and then return back to processing of that big file? Thanks _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com