From: Kerem Gümrükcü on
If this works for you, then everything
is perfect,...!



Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project:
Latest Open-Source Projects:

"David Given" <dg(a)> schrieb im Newsbeitrag
> On 05/02/10 02:26, Kerem Gümrükcü wrote:
> [...]
>> never rely on such a assumption! You should use some kind of
>> synchronization like kernel primitives for tasks that possibly could
>> clash, since windows is not really thread safe when it comes to
>> concurrent UI threads and object access.
> Ah, but because fibres run from within a single thread there is no
> concurrency and therefore no problem! That's the beauty of coroutines
> --- they allow you to decouple flow of execution from the stack,
> allowing you to have multiple stacks between which you shift as you
> desire. As it's all synchronous and explicit all the concurrency
> problems of threads just vanish.
> (This is, in fact, *exactly* the sort of problem that coroutines are
> for, and I wish I'd thought of them earlier. I was only reminded that
> Windows has decent coroutine support when I saw the section on fibres
> while reading up on the threading APIs...)
> In fact, it's all working beautifully now; the application has its own
> event loop in one fibre, and Windows has *its* own event loop in another
> fibre, and I simply pass control from one to the other whenever I need
> to send an (application) event. Very elegant and surprisingly easy.
> --
> ┌─── ───── ─────
> │
> │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ }
> │ --- Conway's Game Of Life, in one line of APL