--CdrF4e02JqNVZeln
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

ysantoso-rubytalk / jenny-gnome.dyndns.org (ysantoso-rubytalk / jenny-gnome.dyndns.org) wrote:

> Hi,
> 
> I was wondering why a Continuation is not callable across threads.
> 
> >From the definition at wikipedia:
> 
> "a continuation saves the execution state of a program at a given
> point so that it's possible to resume execution from that state at a
> later point in time."
> 
> If one takes a thread for what it actually is, which is a
> stream-of-execution, then I fail to see a reason, beside the one described
> below, why one thread cannot call a Continuation object generated from
> another thread. 

This paragraph halfway describes how Ruby implements Continuations.

> However, I feel that this is more of a discipline issue on the part of
> the programmer. If your code depends on thread-specific storage, don't
> resume from another thread.

The other option is to implement a sandbox thread that handles callcc
and invoking the continuation.

> So, what is the reason for the restriction? Is there some conceptual
> issue with continuations being callable from across threads, or is
> this just implementation-specific issue?

Its just an implementation-specific issue.  Continuations in Ruby are
implemented as a "frozen" thread which is restored over the top of the
current thread.

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--CdrF4e02JqNVZeln
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFAr4sfMypVHHlsnwQRAta2AJ92bA/YKTBieknJDyn+Igx+gyHQ5gCcC3Yt
d8cc7fHU5wtqlv6xZprzDp4`R1
-----END PGP SIGNATURE-----

--CdrF4e02JqNVZeln--