On Wed, Jan 20, 2016 at 11:58:56PM +0100, "Torsten Hüter" wrote:
> * It's very tricky to get stackful implementations to run stable. Any small > fault results in a crash or deadlock. What's strange in that? When doing pointers even small faults give you a crash (if you are lucky :D). > * The most critical part is stack handling. For Windows Fibers / Pthreads the > library does the job. There are also > some hacks to get Setjmp()/Longjmp() working with multiple stacks, as > Jean-Pauls link has shown, I've tried it but that was crashing > (Setjmp()/Longjmp() seems to be broken too on MinGW64). longjmp is not guaranteed between 'contexts', so that would be expected too... > * Side effects / show stoppers: It's not recommened to use threads for the > wxWidgets GUI, OpenGL requires a context switch per thread. Not a problem, we already declared that all the UI work is done in event handlers (as it should be) > * As already known, Boost::Context is broken on Msys2 - makes it sense that > such a low level library has to be maintained by KiCad developers (?) Otherwise just hope that boost people fix that! > * Is context switching always safe (side effects with 3rd party libraries / > Python etc.)? Context as in thread usually yes, if you are not running concurrently... thread safety *usually* means proper locking of shared data structures > Stackless coroutines: > --------------------- > > * Relative easy to handle, because based on switch()/case(). > * Safer, a wrong state causes only the exit of the coroutine but not a crash. > * Simple implementation Simple?!? Well, maybe implementing but maintaining is another thing... In my experience once you do the stack initialization correctly the setjmp/longjmp is the 'best' coroutine you can do; the non-portable code is relegated to the coroutine creation code so it's easily locked away in some untouchable source file :P OTOH I never did that on Win32/64 so maybe it's totally undependable to work :D Isn't there some MSDN article on doing that? -- Lorenzo Marcantonio CZ Srl - Parma
signature.asc
Description: PGP signature
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp