www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - "Protothreads"

reply Dave <Dave_member pathlink.com> writes:
Is something like this implementable in D with the newly added template and
mixin abilities? http://www.sics.se/~adam/pt/

Assuming they would be useful and it can be done, any opinions on how they would
perform compared to the current threading implementations for both Windows and
Linux?

Thanks.
Mar 14 2006
parent reply Marcio <mqmnews123 sglebs.com> writes:
Dave wrote:
 Is something like this implementable in D with the newly added template and
 mixin abilities? http://www.sics.se/~adam/pt/

It would be really nice to have something like that. I have written a select-based httpd server in the past (no threads, just select on socket / multiplexing) and it was quite fast (I believe other servers like Xitami, lighthttpd etc use a similar approach). But having to use state machines was a pain. Ditto for an rsync server. Something like Protothreads would have been neat. marcio
Mar 15 2006
parent Dave <Dave_member pathlink.com> writes:
In article <dv998q$4ee$1 digitaldaemon.com>, Marcio says...
Dave wrote:
 Is something like this implementable in D with the newly added template and
 mixin abilities? http://www.sics.se/~adam/pt/

It would be really nice to have something like that. I have written a select-based httpd server in the past (no threads, just select on socket / multiplexing) and it was quite fast (I believe other servers like Xitami, lighthttpd etc use a similar approach). But having to use state machines was a pain. Ditto for an rsync server. Something like Protothreads would have been neat. marcio

I agree - I don't know enough about the recent changes in D's template semantics to say if it's possible or not... I'm guessing not, but perhaps there is another way (w/o strictly duplicating the C macro approach)? Thanks, - Dave
Mar 15 2006