Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
RCRegion Class Reference#include <RCRegion.h>
Detailed Descriptionprovides compatability with the OPEN-R type of the same nameDefinition at line 60 of file RCRegion.h.
Member Typedef Documentation
a map from the shared memory key type to the actual region structure
Definition at line 150 of file RCRegion.h.
Member Enumeration DocumentationDifferent methods of handling regions with conflicting keys.
Definition at line 170 of file RCRegion.h.
Constructor & Destructor Documentation
constructor (OPEN-R compatability, name is autogenerated)
Definition at line 112 of file RCRegion.h. Referenced by attach().
constructor, specify your own name for better debugging accountability (not OPEN-R compatable)
Definition at line 121 of file RCRegion.h.
this protected constructor is used for attaching regions previously created by another process (see attach())
Definition at line 185 of file RCRegion.h.
prevents stack allocation -- needs to be heap allocated and reference counted
Definition at line 275 of file RCRegion.cc.
don't call
Member Function Documentation
requests that a specified RCRegion be loaded into the current process's memory space
Definition at line 63 of file RCRegion.cc. Referenced by MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::markRead(), RegionRegistry< MAX_REGIONS, NAME_LEN >::operator[](), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::peekMessage(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::readMessage(), RegionRegistry< MAX_REGIONS, NAME_LEN >::registerRegion(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReceiver(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::~MessageQueue().
the pointer to the shared memory region
Definition at line 129 of file RCRegion.h. Referenced by IPCEventTranslator::bufferRequest(), SharedObjectBase::data(), WorldStatePool::isUnread(), SoundManager::loadBuffer(), SoundManager::play(), IPCEventTranslator::post(), SoundManager::ProcessMsg(), MotionManager::processMsg(), SoundManager::release(), and SharedObject< UPennWalkMC >::SharedObject().
the size of the shared memory region
Definition at line 130 of file RCRegion.h. Referenced by WorldStatePool::isUnread(), and SharedObject< UPennWalkMC >::SharedObject().
sets the next key to be used for automatic assignment to new regions
Definition at line 131 of file RCRegion.h.
return the next region serial number -- doesn't actually increment it though, repeated calls will return the same value until the value is actually used
Definition at line 132 of file RCRegion.h.
returns the identifier of this region
Definition at line 133 of file RCRegion.h. Referenced by MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage(), and SharedObject< UPennWalkMC >::SharedObject().
number of total references to this region, total of all processes
Definition at line 135 of file RCRegion.h. Referenced by SharedObject< UPennWalkMC >::removeRef().
number of references to the region from the current process (in the ProcessID threadgroup sense, not necessarily system-process)
Definition at line 136 of file RCRegion.h.
adds a reference from the current process
Definition at line 75 of file RCRegion.cc. Referenced by SharedObjectBase::operator=(), SoundManager::ProcessMsg(), MotionManager::processMsg(), and SharedObjectBase::SharedObjectBase().
removes a reference from the current process
Definition at line 86 of file RCRegion.cc. Referenced by SoundManager::loadBuffer(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::markRead(), SoundManager::play(), IPCEventTranslator::post(), SoundManager::ProcessMsg(), MessageReceiver::processNextMessage(), SoundManager::release(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReceiver(), SharedObject< UPennWalkMC >::removeRef(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::~MessageQueue().
adds a reference which is held by another shared memory region
Definition at line 167 of file RCRegion.cc. Referenced by MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage().
removes a reference which is held by another shared memory region
Definition at line 177 of file RCRegion.cc. Referenced by MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::markRead(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::readMessage(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReceiver(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::~MessageQueue().
does housekeeping to mark the region as attached and the same number of references in the new process as well
Definition at line 196 of file RCRegion.cc.
returns the number of regions which are currently attached in the process
Definition at line 152 of file RCRegion.h.
Returns an iterator to the beginning of the attached regions mapping -- it->first is the key, it->second is the RCRegion*. If you need thread-safety (i.e. another thread may attach/detach while you are iterating), pass true, and be sure to use attachedAdvance() to increment the iterator! This doesn't prevent other threads from attaching/detaching regions, it only prevents detaching the one you're on. When you're done with a thread-safe iterator, either attachedAdvance() it off the end, or manually call RemoveReference() on the iterator's final region Definition at line 255 of file RCRegion.cc.
Returns an iterator to the end of the attached regions -- it->first is the key, it->second is the RCRegion*. If you need thread-safety (i.e. another thread may attach/detach while you are iterating), be sure to use attachedAdvance() to decrement the iterator! This doesn't prevent other threads from attaching/detaching regions, it only prevents detaching the one you're on. Definition at line 263 of file RCRegion.cc.
Increments the attached region iterator in a thread-safe way -- only use this if you previously passed 'true' to begin(), or are decrementing from end(). If you are using an iterator obtained without thread-safety, just increment it normally -- don't switch to this or it will screw up reference counting. If you insist on switching back and forth between thread-safe advance (this function) and normal iterator advancing, you will need to add a reference to the current iterator's region before calling this. When you're done, either advance off the end, or manually call RemoveReference() on the iterator's final region Definition at line 266 of file RCRegion.cc.
returns the size of the region to be allocated, given the size requested by the client
Definition at line 283 of file RCRegion.cc. Referenced by RemoveReference().
intializes and returns staticLock
Definition at line 292 of file RCRegion.cc. Referenced by aboutToFork(), AddReference(), attach(), and RemoveReference().
returns the qualified version of this region's key (see getQualifiedName(const std::string& key) )
Definition at line 206 of file RCRegion.h.
wraps the region's key with a root path prefix and optionally a PID suffix (see useUniqueMemoryRegions and shmRoot)
Definition at line 380 of file RCRegion.cc.
opens a region either in "pure" shared memory, or in file-backed shared memory, based on whether USE_UNBACKED_SHM is defined
Definition at line 394 of file RCRegion.cc.
unlinks a region either in "pure" shared memory, or in file-backed shared memory, based on whether USE_UNBACKED_SHM is defined
Definition at line 401 of file RCRegion.cc. Referenced by RemoveReference().
initializes the region's information, either creating a new shared memory region or attempting to connect to a pre-existing one
Definition at line 408 of file RCRegion.cc.
Member Data Documentation
maximum guaranteed length for users' region names (might have a little leeway depending on process ID prefix or tmp path prefix)
Definition at line 76 of file RCRegion.h. Referenced by SharedObject< UPennWalkMC >::createRCRegion(), SoundManager::initRegion(), and RCRegion().
determines location of the file backing within file system
Definition at line 87 of file RCRegion.h. Referenced by getQualifiedName().
if true, prefixes region names with rootPID
Definition at line 89 of file RCRegion.h. Referenced by getQualifiedName().
this is the pid of the original process, used for unique names of memory regions; pid_t is from sys/types.h
Definition at line 90 of file RCRegion.h. Referenced by getQualifiedName().
the alignment multiple of the extra space at the end of the region
Definition at line 192 of file RCRegion.h.
the amount of space to leave at the end of the region for housekeeping (reference counts)
Definition at line 194 of file RCRegion.h.
controls what to do about creating a region with a conflicting key (i.e. another region already exists with the same key)
Definition at line 220 of file RCRegion.h.
set to true if we are shutting down because of an error, and trying to unload shared regions to avoid leaking beyond program scope
Definition at line 222 of file RCRegion.h. Referenced by RemoveReference().
set to false if the different "processes" are just threads (and thus the last process reference shouldn't actually trigger unlinking a region
Definition at line 224 of file RCRegion.h. Referenced by RemoveReference().
a lock over all static RCRegion members for the current process, must be obtained before changing reference counts or attaching/detaching regions
Definition at line 226 of file RCRegion.h. Referenced by aboutToFork(), getStaticLock(), and RemoveReference().
serial number of next key -- starts at 1024 for TEKKOTSU_SHM_STYLE==SYSV_SHM, 0 for POSIX_SHM
Definition at line 228 of file RCRegion.h.
a mapping of key values to RCRegion pointers of the attached region
Definition at line 229 of file RCRegion.h. Referenced by aboutToFork(), attach(), and RemoveReference().
key values for the region, namely the system key type (either an integer or string depending on TEKKOTSU_SHM_STYLE) and the size of the region
Definition at line 231 of file RCRegion.h.
pointer to the region's user data
Definition at line 232 of file RCRegion.h. Referenced by RemoveReference().
pointer to the per-process reference counts (stored within the shared region!)
Definition at line 233 of file RCRegion.h. Referenced by AddReference(), and RemoveReference().
The documentation for this class was generated from the following files: |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:58:37 2007 by Doxygen 1.5.4 |