/*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
+* Copyright 2013 Sveriges Television AB http://casparcg.com/\r
*\r
-* This file is part of CasparCG.\r
+* This file is part of CasparCG (www.casparcg.com).\r
*\r
-* CasparCG is free software: you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation, either version 3 of the License, or\r
-* (at your option) any later version.\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
*\r
-* CasparCG is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-\r
-* You should have received a copy of the GNU General Public License\r
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
*\r
+* Author: Nicklas P Andersson\r
*/\r
+\r
#pragma once\r
\r
#include "../util/thread.h"\r
\r
#include "AMCPCommand.h"\r
\r
-#include <tbb\mutex.h>\r
+#include <common/concurrency/executor.h>\r
+\r
+#include <boost/property_tree/ptree_fwd.hpp>\r
+#include <boost/timer.hpp>\r
+\r
+#include <tbb/spin_mutex.h>\r
\r
namespace caspar { namespace protocol { namespace amcp {\r
\r
-class AMCPCommandQueue : public IRunnable\r
+class AMCPCommandQueue\r
{\r
AMCPCommandQueue(const AMCPCommandQueue&);\r
AMCPCommandQueue& operator=(const AMCPCommandQueue&);\r
public:\r
- AMCPCommandQueue();\r
+ AMCPCommandQueue(const std::wstring& name);\r
~AMCPCommandQueue();\r
\r
- bool Start();\r
- void Stop();\r
void AddCommand(AMCPCommandPtr pCommand);\r
\r
-private:\r
- Thread commandPump_;\r
- virtual void Run(HANDLE stopEvent);\r
- virtual bool OnUnhandledException(const std::exception& ex) throw();\r
-\r
- Event newCommandEvent_;\r
+ boost::property_tree::wptree info() const;\r
\r
- //Needs synro-protection\r
- std::list<AMCPCommandPtr> commands_;\r
- tbb::mutex mutex_;\r
+ static boost::property_tree::wptree info_all_queues();\r
+private:\r
+ executor executor_;\r
+ mutable tbb::spin_mutex running_command_mutex_;\r
+ bool running_command_;\r
+ std::wstring running_command_name_;\r
+ std::wstring running_command_params_;\r
+ boost::timer running_command_since_;\r
};\r
typedef std::tr1::shared_ptr<AMCPCommandQueue> AMCPCommandQueuePtr;\r
\r