Author: cctrieloff
Date: 2007-09-17 13:29:05 -0400 (Mon, 17 Sep 2007)
New Revision: 927
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
Log:
fixed core on ~
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-09-17 16:05:40 UTC (rev 926)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-09-17 17:29:05 UTC (rev 927)
@@ -220,7 +220,7 @@
}
void
-jcntl::aio_wr_callback(jcntl* journal, u_int32_t num_dtoks)
+jcntl::aio_wr_callback(jcntl* journal, u_int32_t num_dtoks)
{
//kpvdr TODO -- this list needs to be mutexed...???
@@ -232,32 +232,36 @@
for (u_int32_t i=0; i<num_dtoks; i++)
{
data_tok*& dtokp = this_dtok_list.front();
- data_tok::write_state st = dtokp->wstate();
- if (st == data_tok::ENQ)
- {
+ if (!journal->is_stopped())
+ {
+ data_tok::write_state st = dtokp->wstate();
+ if (st == data_tok::ENQ)
+ {
//std::cout << "----- enqueueComplete rid=" << dtokp->rid()
<< std::endl;
-
- dtokp->getSourceMessage()->enqueueComplete();
- /// cct --- if TPC work out what to do !!!
- }
- else if (dtokp->wstate() == data_tok::DEQ)
- {
+
+ dtokp->getSourceMessage()->enqueueComplete();
+ /// cct --- if TPC work out what to do !!!
+ }
+ else if (dtokp->wstate() == data_tok::DEQ)
+ {
//std::cout << "----- dequeueComplete rid=" << dtokp->rid()
<< std::endl;
- dtokp->getSourceMessage()->dequeueComplete();
+ dtokp->getSourceMessage()->dequeueComplete();
- if ( dtokp->getSourceMessage()->isDequeueComplete() ) // clear id after last
dequeue
- dtokp->getSourceMessage()->setPersistenceId(0);
-
- }
+ if ( dtokp->getSourceMessage()->isDequeueComplete() ) // clear id after
last dequeue
+ dtokp->getSourceMessage()->setPersistenceId(0);
+ }
+ }
this_dtok_list.pop_front();
- delete dtokp;
+ delete dtokp;
}
+
}
void
-jcntl::aio_rd_callback(jcntl* journal, u_int32_t num_dtoks)
+jcntl::aio_rd_callback(jcntl* journal, u_int32_t num_dtoks)
{
+
//kpvdr TODO -- can we get rid of the copy???
// need to delete the dtok's
std::deque<rhm::journal::data_tok*>
this_dtok_list(journal->_aio_rd_cmpl_dtok_list.begin(),
@@ -266,13 +270,17 @@
for (u_int32_t i=0; i<num_dtoks; i++)
{
data_tok*& dtokp = this_dtok_list.front();
- if (dtokp->wstate() == data_tok::ENQ && dtokp->rstate() ==
data_tok::READ)
- {
- // cct call the recovery manager. / lazyload..
- }
+ if (!journal->is_stopped())
+ {
+ if (dtokp->wstate() == data_tok::ENQ && dtokp->rstate() ==
data_tok::READ)
+ {
+ // cct call the recovery manager. / lazyload..
+ }
+ }
this_dtok_list.pop_front();
delete dtokp;
}
+
}
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-09-17 16:05:40 UTC (rev 926)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-09-17 17:29:05 UTC (rev 927)
@@ -268,6 +268,15 @@
* AIO operations to complete.
*/
void stop(bool block_for_aio_cmpl = false) throw (jexception);
+
+ /**
+ * \brief Check if the journal is stopped.
+ *
+ *
+ * \return <b><i>true</i></b> if the jouranl is stopped;
+ * <b><i>false</i></b> otherwise.
+ */
+ bool is_stopped() {return _stop_flag;}
/**
* \brief Force a flush of the write page cache, creating a single AIO write
operation.