On Mon, Nov 12, 2012 at 11:45 PM, Alex Mizrahi <span dir="ltr"><<a href="mailto:alex.mizrahi@gmail.com" target="_blank">alex.mizrahi@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>If I understand correctly the whole point of lightweight threads is that they are more lightweight than native threads. Thus having 1 native thread for each 1 lightweight thread kinda defeats the purpose.<br></div></blockquote>
<div><br>Right :-)<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div></div><div>I wonder isn't it possible to implement it completely on user level, via closures, closure-passing-style transformation or something like that.<br>
</div></blockquote><div><br>It is indeed possible, and has been done (cl-cont for example).  But the resulting object code is rather slow, as it heap-allocates all continuations (which would normally be stack frames).<br>
<br>Perhaps the best portable approach would be a CL -> CL precompiler that would generate code that would use an explicit stack that would be kept in a chained sequence of simple-vectors in the Lisp heap.  I started to work on this at one point, but didn't get far.<br>
<br>-- Scott<br><br></div></div><br>