
Alexey Trenikhin wrote:
When pth switched user context it did not switch exception handlers. For example Coroutine A: try{ switch_to_B(); throw 1; } catch(int){ printf("catched in A") }
Coroutine B: try{ switch_to_A(); printf("bbb"); } catch(int){ printf("catched in B") }
main: create_A(); create_B(); switch_toA();
result: catched in B
I've ran almost the same test using my library and it seems to do the right thing. I can't try Pth right now, but i suspect it would work too, as both libraries are similar. I'm running gcc 3.3.6 under slackware-current. As gcc exception model has not changed since 3.0 (or so), i think that the problem is the platform: I'm not sure, but i think that gcc on windows uses a different system to handle exceptions, putting exception handler data on the stack (to be compatible with other win compilers and the OS itself), while on linux, and maybe other OSes, it uses a different method that need no stack data and only relies on the instruction pointer and registers value (the zero overhead exception model). I might be wrong, but i cannot think of anything else. I'll investigate more later. -- Giovanni P. Deretta