Re: Coroutines for AI
2008-03-01 08:08:51 GMT
>Anyway, fibers FTW for long-running operations that need to wait for
>various kinds of completion, if you can handle the
>error/failure/cancellation cases reasonably.
If you don't mind the initial implementation pain it can be well worth it to layer a fiber abstraction on top
of an extended work queue/thread pool system. This can be a great way to handle error/failure/completion
because you can do it all with a simple structure that gets passed on the queue that includes the fiber
context and any error/result information (or a simple structure + a work function/delegation if you want
to generalize things more).
It can be a very nice way to implement CSP (Communicating Sequential Processes) in a C based language.
Cheers,
Conor
P.S. If you are on a platform that has a good IO Completion Portimplementation (some non-Microsoft
platforms have them now as well),you can use this for your work queue and get the benefits of IOCompletion
Events and scheduling magic.
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
_______________________________________________
Sweng-Gamedev mailing list
Sweng-Gamedev <at> lists.midnightryder.com
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
Attached is the email he wanted me to post below:
RSS Feed