[plt-scheme] Idiom for suspending the top level thread
On Jun 13, 2006, at 6:41 AM, Noel Welsh wrote:
> Thanks. Cookbooked for posterity:
>
>
> http://schemecookbook.org/Cookbook/ThreadSuspendingCurrentThread
>
> N.
>
> --- Matthew Flatt <mflatt at cs.utah.edu> wrote:
>
>> At Tue, 13 Jun 2006 03:54:04 -0700 (PDT), Noel Welsh
>> wrote:
>>> What is the preferred idiom for suspending the top
>> level
>>> thread to stop a program exiting?
>>
>> My favorite is
>> (sync (make-semaphore))
>> or, in MrEd,
>> (yield (make-semaphore))
> ...
Since we're talking posterity here ;) I should point out that those
aren't the same. The second will actually handle events (ie, allow
computation) on the main thread, but the first won't. (Chances are,
this is what you want in most cases, tho).
Robby