[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PATCH: Fully Resumable VM (yield across pcall/callback/meta/iter)
- From: Glenn Maynard <glenn@...>
- Date: Tue, 15 Feb 2005 16:40:55 -0500
On Tue, Feb 15, 2005 at 08:44:23PM +0100, Mike Pall wrote:
> | A way to resume a coroutine and immediately throw an error. This can
> Does any other language have such a concept? I know that everyone is
> working around this issue with native threads, since you cannot reliably
> kill them. Lots of 'if (flag) { dealloc(); pthread_exit(); }' littered all
> over the source. Not pretty -- I really want to avoid this.
I don't do that. I just give classes destructors, return error from the
function and let the compiler clean up. (I never call pthread_exit; I always
exit a thread by returning out of it, since objects need to go out of scope
to be destructed, and I avoid C++ exceptions due to code bloat.) I try
to avoid all cases of sprinkled-cleanup-code (not that I'm always successful).
(I don't know if that's relevant here--very little experience with coroutines--
but it's worth mentioning.)
--
Glenn Maynard