kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #22806
Re: KiCad Coroutines
Hi,
Lorenzo:
Sorry, perhaps I've expressed it not correctly in my latest mail, I've just written down my subjective impressions, while working on the code, that are mostly rhetoric questions.
>> 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...
I don't understand this comment. Maintaining of this code is easier, because it depends only on the C++ standard library, works on every platform - as long as the language specification is not changed. If you mean the functions itself, yes - more work but still not very hard to maintain - as long as you're knowing the restrictions of this approach.
>>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?
But this is the whole point :) - an robust implementation that works on every platform, with minimal side effects and ideally easy to maintain, dropping the dependency of the Boost library. I've not the impression that setjmp()/longjmp() is the easiest/best solution - please also read the first mail about this subject. In the "Protothreads" link you can find also a discussion about setjmp()/longjmp().
--
There are multiple ways to solve these issues and there is no requirement to use coroutines at all. They are just used by the tool framework code to avoid writing explicit state machines, also the coroutines itself manage there the events. So the most radical way would be to completely drop coroutines. I've shown with my examples some alternatives.
Thanks,
Torsten
Follow ups
References
-
Re: KiCad Coroutines
From: Wayne Stambaugh, 2016-01-06
-
Re: KiCad Coroutines
From: Torsten Hüter, 2016-01-07
-
Re: KiCad Coroutines
From: jp charras, 2016-01-07
-
Re: KiCad Coroutines
From: Lorenzo Marcantonio, 2016-01-07
-
Re: KiCad Coroutines
From: jp charras, 2016-01-07
-
Re: KiCad Coroutines
From: Mário Luzeiro, 2016-01-07
-
Re: KiCad Coroutines
From: Lorenzo Marcantonio, 2016-01-07
-
Re: KiCad Coroutines
From: Tomasz Wlostowski, 2016-01-07
-
Re: KiCad Coroutines
From: Torsten Hüter, 2016-01-15
-
Re: KiCad Coroutines
From: Torsten Hüter, 2016-01-20
-
Re: KiCad Coroutines
From: Lorenzo Marcantonio, 2016-01-21