Browse Source

[2211] use swap instead of splice. for this purpose it's enough and simpler.

JINMEI Tatuya 12 years ago
parent
commit
07b436b864
1 changed files with 2 additions and 3 deletions
  1. 2 3
      src/bin/auth/datasrc_clients_mgr.h

+ 2 - 3
src/bin/auth/datasrc_clients_mgr.h

@@ -356,13 +356,12 @@ DataSrcClientsBuilderBase<MutexType, CondVarType>::run() {
             std::list<Command> current_commands;
             std::list<Command> current_commands;
             {
             {
                 // Move all new commands to local queue under the protection of
                 // Move all new commands to local queue under the protection of
-                // queue_mutex_.  Note that list::splice() should never throw.
+                // queue_mutex_.
                 typename MutexType::Locker locker(*queue_mutex_);
                 typename MutexType::Locker locker(*queue_mutex_);
                 while (command_queue_->empty()) {
                 while (command_queue_->empty()) {
                     cond_->wait(*queue_mutex_);
                     cond_->wait(*queue_mutex_);
                 }
                 }
-                current_commands.splice(current_commands.end(),
-                                        *command_queue_);
+                current_commands.swap(*command_queue_);
             } // the lock is release here.
             } // the lock is release here.
 
 
             while (keep_running && !current_commands.empty()) {
             while (keep_running && !current_commands.empty()) {