Remove Journal from most Stoppable overrides

This commit is contained in:
Vinnie Falco
2013-10-04 00:13:25 -07:00
parent b60a7f3363
commit 5831a53697
2 changed files with 32 additions and 38 deletions

View File

@@ -65,47 +65,47 @@ void Stoppable::stopped ()
m_stoppedEvent.signal();
}
void Stoppable::onPrepare (Journal journal)
void Stoppable::onPrepare ()
{
}
void Stoppable::onStart (Journal journal)
void Stoppable::onStart ()
{
}
void Stoppable::onStop (Journal journal)
void Stoppable::onStop ()
{
stopped();
}
void Stoppable::onChildrenStopped (Journal journal)
void Stoppable::onChildrenStopped ()
{
}
//------------------------------------------------------------------------------
void Stoppable::prepareRecursive (Journal journal)
void Stoppable::prepareRecursive ()
{
onPrepare (journal);
for (Children::const_iterator iter (m_children.cbegin ());
iter != m_children.cend(); ++iter)
iter->stoppable->prepareRecursive (journal);
iter->stoppable->prepareRecursive ();
onPrepare ();
}
void Stoppable::startRecursive (Journal journal)
void Stoppable::startRecursive ()
{
onStart (journal);
onStart ();
for (Children::const_iterator iter (m_children.cbegin ());
iter != m_children.cend(); ++iter)
iter->stoppable->startRecursive (journal);
iter->stoppable->startRecursive ();
}
void Stoppable::stopAsyncRecursive (Journal journal)
void Stoppable::stopAsyncRecursive ()
{
onStop (journal);
onStop ();
for (Children::const_iterator iter (m_children.cbegin ());
iter != m_children.cend(); ++iter)
iter->stoppable->stopAsyncRecursive (journal);
iter->stoppable->stopAsyncRecursive ();
}
void Stoppable::stopRecursive (Journal journal)
@@ -120,7 +120,7 @@ void Stoppable::stopRecursive (Journal journal)
//
memoryBarrier ();
m_childrenStopped = true;
onChildrenStopped (journal);
onChildrenStopped ();
// Now block on this Stoppable.
//
@@ -151,30 +151,24 @@ bool RootStoppable::isStopping() const
return m_calledStopAsync.get() != 0;
}
void RootStoppable::prepare (Journal journal)
void RootStoppable::prepare ()
{
if (! m_prepared.compareAndSetBool (1, 0))
{
journal.warning << "Stoppable::prepare called again";
return;
}
prepareRecursive (journal);
prepareRecursive ();
}
void RootStoppable::start (Journal journal)
void RootStoppable::start ()
{
// Courtesy call to prepare.
if (m_prepared.compareAndSetBool (1, 0))
prepareRecursive (journal);
prepareRecursive ();
if (! m_started.compareAndSetBool (1, 0))
{
journal.warning << "Stoppable::start called again";
return;
}
startRecursive (journal);
startRecursive ();
}
void RootStoppable::stop (Journal journal)
@@ -185,14 +179,14 @@ void RootStoppable::stop (Journal journal)
return;
}
stopAsync (journal);
stopAsync ();
stopRecursive (journal);
}
void RootStoppable::stopAsync (Journal journal)
void RootStoppable::stopAsync ()
{
if (! m_calledStopAsync.compareAndSetBool (1, 0))
return;
stopAsyncRecursive (journal);
stopAsyncRecursive ();
}

View File

@@ -185,10 +185,10 @@ public:
The default implementation does nothing.
Guaranteed to only be called once.
*/
virtual void onPrepare (Journal journal);
virtual void onPrepare ();
/** Override called during start. */
virtual void onStart (Journal journal);
virtual void onStart ();
/** Override called when the stop notification is issued.
@@ -211,7 +211,7 @@ public:
Guaranteed only to be called once.
Must be safe to call from any thread at any time.
*/
virtual void onStop (Journal journal);
virtual void onStop ();
/** Override called when all children have stopped.
@@ -231,7 +231,7 @@ public:
Guaranteed only to be called once.
Must be safe to call from any thread at any time.
*/
virtual void onChildrenStopped (Journal journal);
virtual void onChildrenStopped ();
private:
friend class RootStoppable;
@@ -248,9 +248,9 @@ private:
Stoppable* stoppable;
};
void prepareRecursive (Journal journal);
void startRecursive (Journal journal);
void stopAsyncRecursive (Journal journal);
void prepareRecursive ();
void startRecursive ();
void stopAsyncRecursive ();
void stopRecursive (Journal journal);
protected:
@@ -280,7 +280,7 @@ public:
Thread safety:
May be called from any thread.
*/
void prepare (Journal journal = Journal());
void prepare ();
/** Start all contained Stoppable objects.
The default implementation does nothing.
@@ -288,7 +288,7 @@ public:
Thread safety:
May be called from any thread.
*/
void start (Journal journal = Journal());
void start ();
/** Notify a root stoppable and children to stop, and block until stopped.
Has no effect if the stoppable was already notified.
@@ -304,7 +304,7 @@ public:
Thread safety:
Safe to call from any thread at any time.
*/
void stopAsync (Journal journal = Journal());
void stopAsync ();
private:
Atomic <int> m_prepared;