Re: Ramifications of Removing Coroutines or Implement at higher level than C

"dennisf486" <[email protected]>
Newsgroups gmane.comp.lang.io
Message-ID <[email protected]>
Re:  Coroutines compile option -

Oh there's a USE_VALGRIND option?  Sweet.

Re:  Catch C++ exceptions at binding site -

I do already catch all C++ exceptions in the bindings.  However, my C++ and Io interaction is highly re-entrant.  This is what my call stack looks like:
 - C++ launches Io
 - Io calls a C++ function
 - The C++ function activates an IoBlock
 - Io code in the block may attempt to go to another coroutine
 - Io code on the other coroutine may also call C++ functions
 - When this nested C++ code throws an exception, the process wigs out *BEFORE* I even get to my catch block around the binding site.  In fact it even crashes the process to try throw and catch in one line of code:  try { throw exception; } catch (exception) { never gets to break point here };.

It's still possible this is due to some problem in my C++ code (like a bad memory free in a destructor).  But I think the C++ exception mechanism itself is becoming corrupted.  I haven't done x86 assembly programming in a long time but I guess I'm going to have to debug this one at that level to really know for sure.

Re:  Just change the implementation of coroutines, not remove them -

This is what I really mean.  Yeah I'd probably do it with threads and a global interpreter lock.  Not pretty but shouldn't require very much code change.  Or do it at the interpreter level like Stackless Python, but that would be a much larger change.  I might do that if I eventually port Io to C++ as I've thought off and on about doing.  (If I did that it would be a friendly gesture to C based Io, saying "Io is so cool it deserves more than one implementation", not "I'm in a huff so I'm going to take my ball and play somewhere else.")  In that case I wouldn't be worried about losing support for Exceptions because I would just use C++ exceptions.


--- In [email protected], Steve Dekorte <steve@...> wrote:
>
> 
> On C++ exceptions hosing coros: 
> 
> 	Wouldn't putting C++ catch on every location that Io call's into C++ in your bindings resolve it?
> 
> On valgrind:
> 
> 	Did you define USE_VALGRIND so Coro.c will handle it?
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.