
Alexey Trenikhin wrote:
On 4/28/06, Giovanni P. Deretta <gpderetta@gmail.com> wrote:
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 beleive you are right about platform. But I think problem not in using stack (stack is switched anyway), but more likely context switching mechanism does not switch FS:[0] which points to top exception registration record.
I've done some little research (googled for 'windows exceptions and fibers') and have obtained conflicting results. Some sources claim that fibers are not completely safe in the face of exceptions, other (most of them) claim that fibers correctly handle them. Anyway, i downloaded and looked at Pth code, and it does not uses fibers on windows (it manually modifies the stack pointer in the setjmp jmp_buf). Let's hope that using fibers will do The Righ Thing (TM).
Btw, I can participate in porting/testing windows/fibers version (if it is not early than May 25th)
Help for Windows porting would be greatly appreciated. I plan to submit the library for the google SoC, so the time frame for the completion is not short (whole summer). -- Giovanni P. Deretta