| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
WorldStatePool Class Reference#include <WorldStatePool.h>
Inheritance diagram for WorldStatePool: ![]() Detailed Descriptionholds multiple instances of WorldState, allows one process to be updating while another is readingUse the AutoGetReadState and AutoGetWriteState to access individual WorldState entries... their constructors and destructors allow WorldStatePool to keep track of which entries are in use. When a state wants to write, it is given the oldest unused entry to write into. During writing, other accessors can read the newest (complete) entry, or concurrently write into a different entry (in case they don't want to wait for the other process to finish). A global lock (lock) is used while choosing an entry, and individual locks (writeLocks) are used while writing into entries (to easily allow readers to block on the lock until writing is done) One point of trickiness is that entries being written are moved to the end of the list when the writing begins, not when it is complete. Readers can always scan backwards in the list to find the newest entries, but writers must check the end to see if newer (or equivalent) frames are already in progress, as well as the beginning to find the oldest unreferenced. When a writer tries to access an entry, and another writer is already processing that frame, if blocking is set then the writer will given that entry once the original is done with it (so check your frame index when you receive it so you can tell if it was already processed). If blocking is *not* set, then you will get a separate entry with no indication another process is also working on the same frame.
Definition at line 42 of file WorldStatePool.h.
Member Function Documentation
does the actual work of releaseResource() this is split off as a non-virtual function to avoid some process identity issues that occur with virtual functions under Aperios Definition at line 59 of file WorldStatePool.cc.
does the actual work of useResource() this is split off as a non-virtual function to avoid some process identity issues that occur with virtual functions under Aperios Definition at line 33 of file WorldStatePool.cc.
returns true if the process should call WorldState::read (i.e. msg has new or unprocessed data (such as motion needs to supply feedback)) only one call to this can be made at a time per process (not threadsafe, but is multi-process safe)
Definition at line 93 of file WorldStatePool.cc.
Member Data Documentation
this lock indicates/controls whether the state is available for reading The lock is set before handing out to a writer with a new frame number, and released when a writer has marked the entry complete (via the WriteRequest upon releaseResource()) Definition at line 243 of file WorldStatePool.h. Referenced by doneWritingState(), getCurrentReadState(), getCurrentWriteState(), isComplete(), and WorldStatePool().
the status is intended as a bitfield to support communication between writers if they need to cooperatively fill out an entry The value is set to 0 before handing out to a writer with a new frame number Definition at line 238 of file WorldStatePool.h. Referenced by doReleaseResource(), doUseResource(), getCurrentWriteState(), and WorldStatePool().
The documentation for this class was generated from the following files: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tekkotsu v3.0 |
Generated Fri May 11 20:09:02 2007 by Doxygen 1.4.7 |