Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread Joseph Stewart
I really like rsc's libtask and have managed to hide it in a few products. As for your question: What architecture? Any runtime available? Personally, I've used libtask on ARM/x86 under Linux/OSX... hardly bare metal though. The current implementation depends mostly on the ucontext API +

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread David du Colombier
Russ implemented his own setmcontext and getmcontext functions to work on systems that doesn't properly support ucontext. So I don't think you really need ucontext support in your libc. By the way, I maintain an updated version of libtask: https://github.com/0intro/libtask I've used it on quite

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread Joseph Stewart
David, it's good to hear you're keeping libtask updated... I'll check it out for sure! On Thu, Jul 9, 2015 at 11:09 AM, David du Colombier 0in...@gmail.com wrote: Russ implemented his own setmcontext and getmcontext functions to work on systems that doesn't properly support ucontext. So I

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread Bakul Shah
Your use is different and simple enough that I would suggest doing this from scratch in pure C. Or start from an existing setjmp based implementation. It should really be a couple pages of code at most. On Jul 9, 2015, at 9:12 AM, st...@quintile.net st...@quintile.net wrote: co routines

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread Joseph Stewart
BTW, somewhere I wired in TADNS (http://adns.sourceforge.net/) so libtask's network lookups didn't block. Let me know if you have any interest in me cleaning it up for use. -joe On Thu, Jul 9, 2015 at 11:09 AM, David du Colombier 0in...@gmail.com wrote: Russ implemented his own setmcontext

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread Bakul Shah
Sounds like all you want are coroutines (with create, destroy switch-to calls) and wait queues (with create, destroy, signal wait calls). With these you can build channels easily. With a bit more work you can even implement pre-emption but then you need mutexes. Setjmp/longjmp is fine (that

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread Joseph Stewart
One other thing that I've looked at but never used is Adam Dunkels' protothreads (http://dunkels.com/adam/pt/) although you'd still need to roll your own channel library. On Thu, Jul 9, 2015 at 10:50 AM, Steve Simon st...@quintile.net wrote: The system I am trying to add libtask to has no

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread erik quanstrom
all process-like implementations except if they give up on per-cpu multiprogramming are setjmp based at heart. - erik On Jul 9, 2015 09:31, Bakul Shah ba...@bitblocks.com wrote: Your use is different and simple enough that I would suggest doing this from scratch in pure C. Or start from an

[9fans] rsc's libtask on embedded

2015-07-09 Thread Steve Simon
Anyone stripped rsc's libtask for use on a bare metal embedded system, I'am about to do it but if somone already has I could steal it. -Steve

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread st...@quintile.net
I looked at proto, they are just state machines pretending to be threads (imho) - not my style. libtask for me, I hope I can slice it a little and put the non-bear-metal bits in seperate files so I can offer the changes back. co routines plus channels is exactly what I want. -Steve On 9

Re: [9fans] rsc's libtask on embedded

2015-07-09 Thread Steve Simon
The system I am trying to add libtask to has no runtime other than libc. Corrently it is an even based system that uses a min main loop and a twisty maze of nested state machines that all look the same. Hence my desire to add co-routines + channels (i.e. exactly what libtask is) to it. I have no