On Wed, Apr 30, 2008 at 5:37 PM, Jens Alfke <[EMAIL PROTECTED]> wrote:
>
>  On 30 Apr '08, at 12:35 PM, Michael Ash wrote:
>
>
> > This doesn't work because you can have multiple sheets which get
> > dismissed out of order.
> > For example, method X shows sheet A, method Y shows sheet B, user
> > dismisses sheet A. Now you need to return back to method X but method
> > Y is still on the call stack.
> >
>
>  That's what would happen without coroutines. But with coroutines it's no
> problem, because X and Y aren't on the same call stack:
>
>  Coroutine 1 is running:
>         ...
>         method X calls runSheet(A)
>         runSheet displays the sheet, then blocks and transfers control
>  Now coroutine 2 is running:
>         ...
>         method Y calls runSheet(B)
>         runSheet displays the sheet, then blocks and transfers control
>  Main coroutine is running:
>         ...events being handled...
>         User clicks on OK button in sheet A
>         Main coroutine wakes up coroutine 1
>  Coroutine 1 is running:
>         sheet goes away, runSheet(A) returns
>         back to method X
>         ...
>
>  The main coroutine would handle the runloop and events as usual. But it
> would respond to events by messaging their associated coroutines/actors.

The goal was to use coroutines to give sheets a modal interface
without changing the rest of the application's structure. Therefore
the sheet-calling code would still run on the main thread, preventing
this use of coroutines. If you run all of your coroutines on secondary
threads and proxy back to the main thread then you can do this kind of
thing, but that adds a great deal of additional complication.

Mike
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to