diff options
author | Eric Milkie <milkie@10gen.com> | 2015-02-19 15:48:15 -0500 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2015-02-19 16:06:08 -0500 |
commit | b0e50245a3cef4b22d0c4d60586bf843bb9c1861 (patch) | |
tree | 5bd5ad303c42e5671c3f907c3ba8e9f77d29b33c /src | |
parent | ae341c89d09b634047dd080af0f9e173e6d8b6e5 (diff) | |
download | mongo-b0e50245a3cef4b22d0c4d60586bf843bb9c1861.tar.gz |
SERVER-17330 remove server.h and dependencies; all dead code
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/dbcommands.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/dbcommands_generic.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/repl/server.h | 76 | ||||
-rw-r--r-- | src/mongo/s/client_info.cpp | 1 | ||||
-rw-r--r-- | src/mongo/s/shardconnection.cpp | 1 | ||||
-rw-r--r-- | src/mongo/server.h | 45 | ||||
-rw-r--r-- | src/mongo/util/concurrency/task.cpp | 123 |
7 files changed, 1 insertions, 247 deletions
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index db5a64f8b96..8141b4ed09c 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -80,7 +80,6 @@ #include "mongo/s/d_state.h" #include "mongo/s/stale_exception.h" // for SendStaleConfigException #include "mongo/scripting/engine.h" -#include "mongo/server.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/md5.hpp" diff --git a/src/mongo/db/dbcommands_generic.cpp b/src/mongo/db/dbcommands_generic.cpp index 02568690912..edecb6578b9 100644 --- a/src/mongo/db/dbcommands_generic.cpp +++ b/src/mongo/db/dbcommands_generic.cpp @@ -53,7 +53,6 @@ #include "mongo/db/server_options.h" #include "mongo/db/stats/counters.h" #include "mongo/scripting/engine.h" -#include "mongo/server.h" #include "mongo/util/exit.h" #include "mongo/util/fail_point.h" #include "mongo/util/fail_point_service.h" diff --git a/src/mongo/db/repl/server.h b/src/mongo/db/repl/server.h deleted file mode 100644 index 9216c0bc87d..00000000000 --- a/src/mongo/db/repl/server.h +++ /dev/null @@ -1,76 +0,0 @@ -/** -* Copyright (C) 2008 10gen Inc. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Affero General Public License, version 3, -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful,b -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* As a special exception, the copyright holders give permission to link the -* code of portions of this program with the OpenSSL library under certain -* conditions as described in each individual source file and distribute -* linked combinations including the program with the OpenSSL library. You -* must comply with the GNU Affero General Public License in all respects -* for all of the code used other than as permitted herein. If you modify -* file(s) with this exception, you may extend this exception to your -* version of the file(s), but you are not obligated to do so. If you do not -* wish to do so, delete this exception statement from your version. If you -* delete this exception statement from all source files in the program, -* then also delete it in the license file. -*/ - -#pragma once - -#include <deque> - -#include <boost/thread/condition.hpp> - -#include "mongo/stdx/functional.h" -#include "mongo/util/concurrency/mutex.h" -#include "mongo/util/concurrency/task.h" - -namespace mongo { - - namespace task { - - typedef stdx::function<void()> lam; - - /** typical usage is: task::fork( new Server("threadname") ); */ - class Server : public Task { - public: - /** send a message to the port */ - void send(lam); - - Server(const std::string& name) : m("server"), _name(name), rq(false) { } - virtual ~Server() { } - - /** send message but block until function completes */ - void call(const lam&); - - void requeue() { rq = true; } - - protected: - // REMINDER : for use in mongod, you will want to have this call Client::initThread(). - virtual void starting() { } - - private: - virtual bool initClient() { return true; } - virtual std::string name() const { return _name; } - void doWork(); - std::deque<lam> d; - mongo::mutex m; - boost::condition c; - std::string _name; - bool rq; - }; - - } - -} diff --git a/src/mongo/s/client_info.cpp b/src/mongo/s/client_info.cpp index 758b8cb5936..5452ad49ba4 100644 --- a/src/mongo/s/client_info.cpp +++ b/src/mongo/s/client_info.cpp @@ -49,7 +49,6 @@ #include "mongo/s/cursors.h" #include "mongo/s/grid.h" #include "mongo/s/request.h" -#include "mongo/server.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/s/shardconnection.cpp b/src/mongo/s/shardconnection.cpp index daba02eb2f7..950aa0523a2 100644 --- a/src/mongo/s/shardconnection.cpp +++ b/src/mongo/s/shardconnection.cpp @@ -45,7 +45,6 @@ #include "mongo/s/shard.h" #include "mongo/s/stale_exception.h" #include "mongo/s/version_manager.h" -#include "mongo/server.h" #include "mongo/util/concurrency/spin_lock.h" #include "mongo/util/exit.h" #include "mongo/util/log.h" diff --git a/src/mongo/server.h b/src/mongo/server.h deleted file mode 100644 index e6614a84efc..00000000000 --- a/src/mongo/server.h +++ /dev/null @@ -1,45 +0,0 @@ -//server.h - -/** -* Copyright (C) 2012 10gen Inc. -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU Affero General Public License, version 3, -* as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Affero General Public License for more details. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* As a special exception, the copyright holders give permission to link the -* code of portions of this program with the OpenSSL library under certain -* conditions as described in each individual source file and distribute -* linked combinations including the program with the OpenSSL library. You -* must comply with the GNU Affero General Public License in all respects -* for all of the code used other than as permitted herein. If you modify -* file(s) with this exception, you may extend this exception to your -* version of the file(s), but you are not obligated to do so. If you do not -* wish to do so, delete this exception statement from your version. If you -* delete this exception statement from all source files in the program, -* then also delete it in the license file. -*/ - -/** - * Inclusion of this file is DEPRECATED. Prefer to Include What You Use (IWYU). - */ - -#pragma once - -#if !defined(MONGO_EXPOSE_MACROS) -# error this file is for mongo server programs not client lib -#endif - -#include <map> -#include <vector> -#include <set> - -#include "mongo/platform/compiler.h" diff --git a/src/mongo/util/concurrency/task.cpp b/src/mongo/util/concurrency/task.cpp index 68b439ec31f..915cdecbc66 100644 --- a/src/mongo/util/concurrency/task.cpp +++ b/src/mongo/util/concurrency/task.cpp @@ -27,36 +27,18 @@ * then also delete it in the license file. */ -#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kControl - #include "mongo/platform/basic.h" -#include <boost/thread/condition.hpp> -#include <iostream> - #include "mongo/util/concurrency/task.h" -#include "mongo/db/repl/server.h" +#include "mongo/util/assert_util.h" #include "mongo/util/exit.h" -#include "mongo/util/log.h" -#include "mongo/util/startup_test.h" #include "mongo/util/time_support.h" namespace mongo { - using std::cout; - using std::endl; - namespace task { - /*void foo() { - boost::mutex m; - boost::mutex::scoped_lock lk(m); - boost::condition cond; - cond.wait(lk); - cond.notify_one(); - }*/ - Task::Task() : BackgroundJob( true /* deleteSelf */ ) { n = 0; @@ -101,106 +83,3 @@ namespace mongo { } } - - - -/* task::Server */ - -namespace mongo { - namespace task { - - /* to get back a return value */ - struct Ret { - Ret() : done(false),m("Ret") { } - bool done; - mongo::mutex m; - boost::condition c; - const lam *msg; - void f() { - (*msg)(); - done = true; - c.notify_one(); - } - }; - - void Server::call( const lam& msg ) { - Ret r; - r.msg = &msg; - lam f = stdx::bind(&Ret::f, &r); - send(f); - { - scoped_lock lk(r.m); - while( !r.done ) - r.c.wait(lk.boost()); - } - } - - void Server::send( lam msg ) { - { - scoped_lock lk(m); - d.push_back(msg); - wassert( d.size() < 1024 ); - } - c.notify_one(); - } - - void Server::doWork() { - starting(); - while( 1 ) { - lam f; - try { - scoped_lock lk(m); - while( d.empty() ) - c.wait(lk.boost()); - f = d.front(); - d.pop_front(); - } - catch(...) { - log() << "ERROR exception in Server:doWork?" << endl; - } - try { - f(); - if( rq ) { - rq = false; - { - scoped_lock lk(m); - d.push_back(f); - } - } - } - catch(std::exception& e) { - log() << "Server::doWork task:" << name() << " exception:" << e.what() << endl; - } - catch(const char *p) { - log() << "Server::doWork task:" << name() << " unknown c exception:" << - ((p&&strlen(p)<800)?p:"?") << endl; - } - catch(...) { - log() << "Server::doWork unknown exception task:" << name() << endl; - } - } - } - - static Server *s; - static void abc(int i) { - cout << "Hello " << i << endl; - s->requeue(); - } - class TaskUnitTest : public mongo::StartupTest { - public: - virtual void run() { - lam f = stdx::bind(abc, 3); - //f(); - - s = new Server("unittest"); - fork(s); - s->send(f); - - sleepsecs(30); - cout <<" done" << endl; - - } - }; // not running. taskunittest; - - } -} |