From: Andrew G. <ag...@us...> - 2007-06-05 03:01:42
|
Update of /cvsroot/zoolib/zoolib/src_other/tuplebase In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28080/src_other/tuplebase Modified Files: ZTSWatcherMUX.cpp ZTSWatcherMUX.h Log Message: Change some instance variable names, to clarify the difference between the ephemeral forced sync vs the always forced sync of a watcher. And change names: fCurrentSync-->fCurrentSyncNumber fNextSync-->fNextSyncNumber to distinguish the sync number from the flags that control whether a sync should be done. Index: ZTSWatcherMUX.cpp =================================================================== RCS file: /cvsroot/zoolib/zoolib/src_other/tuplebase/ZTSWatcherMUX.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ZTSWatcherMUX.cpp 4 Jun 2007 22:53:20 -0000 1.11 +++ ZTSWatcherMUX.cpp 5 Jun 2007 03:01:42 -0000 1.12 @@ -199,7 +199,7 @@ { friend class ZTSWatcherMUX; private: - Watcher(ZTSWatcherMUX& iMUX, bool iForceSync); + Watcher(ZTSWatcherMUX& iMUX, bool iAlwaysForceSync); virtual ~Watcher(); // From ZRefCountedWithFinalization via ZTSWatcher @@ -222,7 +222,7 @@ private: ZTSWatcherMUX& fMUX; - const bool fForceSync; + const bool fAlwaysForceSync; map<int64, WQuery> fWQueries; @@ -236,9 +236,9 @@ void* fCallbackRefcon; }; -ZTSWatcherMUX::Watcher::Watcher(ZTSWatcherMUX& iMUX, bool iForceSync) +ZTSWatcherMUX::Watcher::Watcher(ZTSWatcherMUX& iMUX, bool iAlwaysForceSync) : fMUX(iMUX), - fForceSync(iForceSync) + fAlwaysForceSync(iAlwaysForceSync) {} ZTSWatcherMUX::Watcher::~Watcher() @@ -286,9 +286,9 @@ ZTSWatcherMUX::ZTSWatcherMUX(ZRef<ZTSWatcher> iWatcher, size_t iCacheSize_Queries, size_t iCacheSize_Tuples) -: fCurrentSync(0), - fNextSync(1), - fForceSync(false), +: fCurrentSyncNumber(0), + fNextSyncNumber(1), + fForceNextSync(false), fWatcher(iWatcher), fNextQueryRefcon(1), fCacheSize_Queries(iCacheSize_Queries), @@ -320,9 +320,9 @@ ZRef<ZTSWatcher> ZTSWatcherMUX::NewWatcher() { return this->NewWatcher(false); } -ZRef<ZTSWatcher> ZTSWatcherMUX::NewWatcher(bool iForceSync) +ZRef<ZTSWatcher> ZTSWatcherMUX::NewWatcher(bool iAlwaysForceSync) { - ZRef<Watcher> theWatcher = new Watcher(*this, iForceSync); + ZRef<Watcher> theWatcher = new Watcher(*this, iAlwaysForceSync); fMutex_Structure.Acquire(); fWatchers.insert(theWatcher.GetObject()); fMutex_Structure.Release(); @@ -683,7 +683,7 @@ } - if (!iWatcher->fForceSync && !fForceSync && !iWaitForSync) + if (!iWatcher->fAlwaysForceSync && !fForceNextSync && !iWaitForSync) { // We're not being forced to call Sync, nor does our caller // want us to wait for Sync. @@ -698,11 +698,11 @@ } } - if (const int64 currentSync = fCurrentSync) + if (const int64 currentSyncNumber = fCurrentSyncNumber) { // Wait till the running Sync has completed, in case it's // fetching data underlying a registration our caller has added. - while (currentSync == fCurrentSync) + while (currentSyncNumber == fCurrentSyncNumber) fCondition.Wait(fMutex_Structure); // The other call to Sync may have had IDs added by the server, @@ -728,7 +728,7 @@ addedPTuples.swap(newAddedPTuples); } - if (!iWatcher->fForceSync && !fForceSync) + if (!iWatcher->fAlwaysForceSync && !fForceNextSync) { // We're not being forced to call Sync. if (removedIDs.empty() @@ -744,10 +744,10 @@ // We're committed to calling Sync, so we can switch off the flag // that may have forced us to this point. - fForceSync = false; + fForceNextSync = false; // Record that we're calling Sync - fCurrentSync = fNextSync++; + fCurrentSyncNumber = fNextSyncNumber++; fMutex_Structure.Release(); @@ -849,7 +849,7 @@ } } - fCurrentSync = 0; + fCurrentSyncNumber = 0; fCondition.Broadcast(); for (set<Watcher*>::iterator i = watchersToCallback.begin(); @@ -923,9 +923,9 @@ void ZTSWatcherMUX::Callback() { fMutex_Structure.Acquire(); - if (!fForceSync) + if (!fForceNextSync) { - fForceSync = true; + fForceNextSync = true; // Calling any registered watcher's callback should be enough // to get Sync called, and thus pSyncAll, which may then tickle any // further watcher that needs it. Index: ZTSWatcherMUX.h =================================================================== RCS file: /cvsroot/zoolib/zoolib/src_other/tuplebase/ZTSWatcherMUX.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ZTSWatcherMUX.h 4 Jun 2007 22:53:20 -0000 1.6 +++ ZTSWatcherMUX.h 5 Jun 2007 03:01:42 -0000 1.7 @@ -46,7 +46,7 @@ ~ZTSWatcherMUX(); ZRef<ZTSWatcher> NewWatcher(); - ZRef<ZTSWatcher> NewWatcher(bool iForceSync); + ZRef<ZTSWatcher> NewWatcher(bool iAlwaysForceSync); private: class Watcher; @@ -99,9 +99,9 @@ ZMutex fMutex_Structure; ZCondition fCondition; - int64 fCurrentSync; - int64 fNextSync; - bool fForceSync; + int64 fCurrentSyncNumber; + int64 fNextSyncNumber; + bool fForceNextSync; ZRef<ZTSWatcher> fWatcher; |