TAO_ESF_Copy_On_Write_Write_Guard. More...
#include <ESF_Copy_On_Write.h>
Public Types | |
typedef TAO_ESF_Copy_On_Write_Collection < COLLECTION, ITERATOR > | Collection |
Constructor. | |
Public Member Functions | |
TAO_ESF_Copy_On_Write_Write_Guard (ACE_SYNCH_MUTEX_T &mutex, ACE_SYNCH_CONDITION_T &cond, int &pending_writes, int &writing_flag, Collection *&collection) | |
~TAO_ESF_Copy_On_Write_Write_Guard (void) | |
Destructor. | |
Public Attributes | |
Collection * | copy |
Private Attributes | |
ACE_SYNCH_MUTEX_T & | mutex |
ACE_SYNCH_CONDITION_T & | cond |
int & | pending_writes |
int & | writing_flag |
Collection *& | collection |
TAO_ESF_Copy_On_Write_Write_Guard.
This helper class atomically increments the reference count of a TAO_ESF_Copy_On_Write_Collection and reads the current collection in the Copy_On_Write class.
Definition at line 87 of file ESF_Copy_On_Write.h.
typedef TAO_ESF_Copy_On_Write_Collection<COLLECTION,ITERATOR> TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::Collection |
Constructor.
Definition at line 91 of file ESF_Copy_On_Write.h.
TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::TAO_ESF_Copy_On_Write_Write_Guard | ( | ACE_SYNCH_MUTEX_T & | mutex, | |
ACE_SYNCH_CONDITION_T & | cond, | |||
int & | pending_writes, | |||
int & | writing_flag, | |||
Collection *& | collection | |||
) |
Definition at line 138 of file ESF_Copy_On_Write.cpp.
: copy (0), mutex (m), cond (c), pending_writes (p), writing_flag (w), collection (cr) { { ACE_GUARD (ACE_SYNCH_MUTEX_T, ace_mon, this->mutex); this->pending_writes++; while (this->writing_flag != 0) this->cond.wait (); this->writing_flag = 1; } // Copy outside the mutex, because it may take a long time. // Nobody can change it, because it is protected by the // writing_flag. // First initialize it (with the correct reference count ACE_NEW (this->copy, Collection); // Copy the contents this->copy->collection = this->collection->collection; // Increase the reference counts ITERATOR end = this->copy->collection.end (); for (ITERATOR i = this->copy->collection.begin (); i != end; ++i) { (*i)->_incr_refcnt (); } }
TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::~TAO_ESF_Copy_On_Write_Write_Guard | ( | void | ) |
Destructor.
Definition at line 180 of file ESF_Copy_On_Write.cpp.
{ Collection *tmp = 0; { ACE_GUARD (ACE_SYNCH_MUTEX_T, ace_mon, this->mutex); tmp = this->collection; this->collection = this->copy; this->writing_flag = 0; this->pending_writes--; this->cond.signal (); } // Delete outside the mutex, because it may take a long time. tmp->_decr_refcnt (); }
Collection*& TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::collection [private] |
Definition at line 108 of file ESF_Copy_On_Write.h.
ACE_SYNCH_CONDITION_T& TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::cond [private] |
Definition at line 105 of file ESF_Copy_On_Write.h.
Collection* TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::copy |
Definition at line 101 of file ESF_Copy_On_Write.h.
ACE_SYNCH_MUTEX_T& TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::mutex [private] |
Definition at line 104 of file ESF_Copy_On_Write.h.
int& TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::pending_writes [private] |
Definition at line 106 of file ESF_Copy_On_Write.h.
int& TAO_ESF_Copy_On_Write_Write_Guard< COLLECTION, ITERATOR, ACE_SYNCH_DECL >::writing_flag [private] |
Definition at line 107 of file ESF_Copy_On_Write.h.