Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

EntryPoint.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_EntryPoint_h_
00003 #define INCLUDED_EntryPoint_h_
00004 
00005 #include "IPC/Thread.h"
00006 #include "Shared/Resource.h"
00007 
00008 //! manages a thread lock to serialize behavior computation and mark whether ::state is being read or written
00009 typedef Thread::Lock EntryPoint;
00010 /*
00011 class EntryPoint : public Resource {
00012 public:
00013   //! constructor, need to specify the WorldStatePool (presumably it's in a shared memory region...)
00014   explicit EntryPoint() : Resource(), lock() {}
00015   
00016   //! an EmptyData implies a WorldStateRead should be passed on to the pool, requesting a write requires a WorldStateWrite to be passed
00017   virtual void useResource(Data& d) {
00018     static_cast<Resource&>(lock).useResource(emptyData); //important to get lock first to make sure using shared defaultRead is safe in multi-threaded env.
00019   }
00020   //! an EmptyData implies a WorldStateRead should be passed on to the pool, requesting a write requires a WorldStateWrite to be passed
00021   virtual void releaseResource(Data& d) {
00022     static_cast<Resource&>(lock).releaseResource(emptyData); //important to release lock last to make sure using shared defaultRead is safe in multi-threaded env.
00023   }
00024   
00025   //! this can be useful when planning to write, get the threadlock to do some initial setup before grabbing an entry from the pool
00026   Thread::Lock& getLock() { return lock; }
00027   
00028 protected:
00029   Thread::Lock lock; //!< only one behavior runs at a time
00030 };
00031 */
00032 
00033 /*! @file
00034  * @brief 
00035  * @author Ethan Tira-Thompson (ejt) (Creator)
00036  */
00037 
00038 #endif

Tekkotsu Hardware Abstraction Layer 5.1CVS
Generated Mon May 9 05:01:38 2016 by Doxygen 1.6.3