[Openmcl-devel] Coroutines/lightweight threads
Andrew Lyon
orthecreedence at gmail.com
Mon Nov 12 17:28:30 PST 2012
Hello, I'm an avid CCL user (have been for over a year now). This is my
first post on the dev list, and I did a lot of research on this topic
before deciding to post to make sure this hasn't been covered before.
Is there any interest in the ClozureCL community in having
lightweight/cooperative threading available in the implementation? I have a
few problems that would be a perfect fit for this (for instance, creating a
blocking interface over non-blocking IO) and I'd love to not only voice my
support for the feature, but also know if anybody else would also like
something like this.
I think the most ideal implementation would be where you explicitly give up
control of the current "micro-thread" to another known thread (on top of
this, something like "yield" could be built in the app itself, if needed).
Matching this to the way OS threads currently work would be awesome...for
instance, unwind-protect would only work for the coroutine it's wrapping
around, so if you give control to another coroutine, that unwind-protect
won't fire if there is an exception. Obviously this would be a big feature,
and probably at least a few people would have opinions on how it would be
implemented, not to mention there's probably a lot going on under the hood
that I'm not aware about...but I'd like to at least open a discussion.
I did try to implement coroutines outside of CCL via libpcl/CFFI (
http://xmailserver.org/libpcl.html) but was met with much resistance and
many segfaults.
Although I'm not familiar with the internals of CCL more than reading the
"Internals" page and most of the docs, I'm more than happy to try getting
my hands dirty and add support myself with some guidance from others (where
do I start, what are the caveats, has anyone else tried this, etc). I'd
also like to know if this is possible using the Virtual Instructions in the
compiler.
I'd love to hear anyone's thoughts on this, and thanks for the great
implementation.
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20121112/4c8d4e9d/attachment.htm>
More information about the Openmcl-devel
mailing list