Re: Synchronous method: How to "wait" for Notification to occur?
Re: Synchronous method: How to "wait" for Notification to occur?
- Subject: Re: Synchronous method: How to "wait" for Notification to occur?
- From: Wade Tregaskis <email@hidden>
- Date: Sun, 24 Aug 2003 23:33:53 +1000
A class I have created has a synchronous method which must not return
until some asynchronous operation has completed and the result is
ready.
This probably isn't what you want to hear, but I think your best bet
is to change your code not to depend on this method being synchronous.
Instead, let it be driven by the completion notification's delivery.
I can't speak for the original author, but I know that in my case at
least this is not possible - the behaviour of my class is well defined
[as synchronous], yet there is no high-level way to synchronously do
the tasks I must perform. So I'd like to consider this question still
open, in case anyone else out there has any ideas. Otherwise, I
strongly agree with the point, which is that it's much easier to
redesign around these problems where possible.
On this topic, one of the solutions I posted about earlier - using
loops, flags and running runloops - is now working in one of my
projects, so I can say that it does actually solve the problem, albeit
messily. If the original author [or any others] want more details,
they can drop me a line off list. I'll be posting the project to
sourceforge soon, once a few other bugs are ironed out, so the source
will soon be freely available [BSD license] for the curious.
Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.