BIND 10 trac2861, updated. d432cd1889063c53a6d5249be9bf9c6029736364 [2861] Share a file descriptor and finished queue
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jul 2 09:26:06 UTC 2013
The branch, trac2861 has been updated
via d432cd1889063c53a6d5249be9bf9c6029736364 (commit)
from 6917e1335e35a4465b9e242a6c3e9b38c909d201 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d432cd1889063c53a6d5249be9bf9c6029736364
Author: Michal 'vorner' Vaner <vorner at vorner.cz>
Date: Tue Jul 2 11:22:15 2013 +0200
[2861] Share a file descriptor and finished queue
Pass the file descriptor to wake up the main thread and the queue to put
the callbacks into to the worker thread. The real socket is not yet
created, nor it is used.
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/datasrc_clients_mgr.h | 20 +++++++++++++++-----
.../auth/tests/datasrc_clients_builder_unittest.cc | 4 +++-
src/bin/auth/tests/test_datasrc_clients_mgr.h | 3 ++-
3 files changed, 20 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/datasrc_clients_mgr.h b/src/bin/auth/datasrc_clients_mgr.h
index 14dbbd1..6af6904 100644
--- a/src/bin/auth/datasrc_clients_mgr.h
+++ b/src/bin/auth/datasrc_clients_mgr.h
@@ -192,8 +192,8 @@ public:
/// \throw isc::Unexpected general unexpected system errors.
DataSrcClientsMgrBase() :
clients_map_(new ClientListsMap),
- builder_(&command_queue_, &cond_, &queue_mutex_, &clients_map_,
- &map_mutex_),
+ builder_(&command_queue_, &callback_queue_, &cond_, &queue_mutex_,
+ &clients_map_, &map_mutex_, -1 /* TEMPORARY */),
builder_thread_(boost::bind(&BuilderType::run, &builder_))
{}
@@ -360,6 +360,11 @@ private:
//
// The list is used as a one-way queue: back-in, front-out
std::list<datasrc_clientmgr_internal::Command> command_queue_;
+ // Similar to above, for the callbacks that are ready to be called.
+ // While the command queue is for sending commands from the main thread
+ // to the work thread, this one is for the other direction. Protected
+ // by the same mutex (queue_mutex_).
+ std::list<datasrc_clientmgr_internal::FinishedCallback> callback_queue_;
CondVarType cond_; // condition variable for queue operations
MutexType queue_mutex_; // mutex to protect the queue
datasrc::ClientListMapPtr clients_map_;
@@ -412,12 +417,15 @@ public:
///
/// \throw None
DataSrcClientsBuilderBase(std::list<Command>* command_queue,
+ std::list<FinishedCallback>* callback_queue,
CondVarType* cond, MutexType* queue_mutex,
datasrc::ClientListMapPtr* clients_map,
- MutexType* map_mutex
+ MutexType* map_mutex,
+ int wake_fd
) :
- command_queue_(command_queue), cond_(cond), queue_mutex_(queue_mutex),
- clients_map_(clients_map), map_mutex_(map_mutex)
+ command_queue_(command_queue), callback_queue_(callback_queue),
+ cond_(cond), queue_mutex_(queue_mutex),
+ clients_map_(clients_map), map_mutex_(map_mutex), wake_fd_(wake_fd)
{}
/// \brief The main loop.
@@ -484,10 +492,12 @@ private:
// The following are shared with the manager
std::list<Command>* command_queue_;
+ std::list<FinishedCallback> *callback_queue_;
CondVarType* cond_;
MutexType* queue_mutex_;
datasrc::ClientListMapPtr* clients_map_;
MutexType* map_mutex_;
+ int wake_fd_;
};
// Shortcut typedef for normal use
diff --git a/src/bin/auth/tests/datasrc_clients_builder_unittest.cc b/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
index bc41385..858fe63 100644
--- a/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
+++ b/src/bin/auth/tests/datasrc_clients_builder_unittest.cc
@@ -54,7 +54,8 @@ protected:
DataSrcClientsBuilderTest() :
clients_map(new std::map<RRClass,
boost::shared_ptr<ConfigurableClientList> >),
- builder(&command_queue, &cond, &queue_mutex, &clients_map, &map_mutex),
+ builder(&command_queue, &callback_queue, &cond, &queue_mutex,
+ &clients_map, &map_mutex, -1 /* TEMPORARY */),
cond(command_queue, delayed_command_queue), rrclass(RRClass::IN()),
shutdown_cmd(SHUTDOWN, ConstElementPtr(), FinishedCallback()),
noop_cmd(NOOP, ConstElementPtr(), FinishedCallback())
@@ -65,6 +66,7 @@ protected:
ClientListMapPtr clients_map; // configured clients
std::list<Command> command_queue; // test command queue
std::list<Command> delayed_command_queue; // commands available after wait
+ std::list<FinishedCallback> callback_queue; // Callbacks from commands
TestDataSrcClientsBuilder builder;
TestCondVar cond;
TestMutex queue_mutex;
diff --git a/src/bin/auth/tests/test_datasrc_clients_mgr.h b/src/bin/auth/tests/test_datasrc_clients_mgr.h
index 9b1a367..0c2b61f 100644
--- a/src/bin/auth/tests/test_datasrc_clients_mgr.h
+++ b/src/bin/auth/tests/test_datasrc_clients_mgr.h
@@ -153,10 +153,11 @@ public:
FakeDataSrcClientsBuilder(
std::list<Command>* command_queue,
+ std::list<FinishedCallback>*,
TestCondVar* cond,
TestMutex* queue_mutex,
isc::datasrc::ClientListMapPtr* clients_map,
- TestMutex* map_mutex)
+ TestMutex* map_mutex, int)
{
FakeDataSrcClientsBuilder::started = false;
FakeDataSrcClientsBuilder::command_queue = command_queue;
More information about the bind10-changes
mailing list