]> git.sesse.net Git - casparcg/commitdiff
Move from boost::thread to std::thread for nearly everything.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 6 May 2017 19:17:44 +0000 (21:17 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 6 May 2017 19:17:44 +0000 (21:17 +0200)
Reduces build time from 5:17 to 4:59 on my system.

52 files changed:
accelerator/StdAfx.h
accelerator/cpu/image/image_mixer.cpp
accelerator/ogl/image/image_mixer.cpp
accelerator/ogl/util/texture.cpp
common/blocking_bounded_queue_adapter.h
common/blocking_priority_queue.h
common/diagnostics/graph.cpp
common/env.cpp
common/except.cpp
common/executor.h
common/future.h
common/lock.h
common/log.cpp
common/os/linux/prec_timer.cpp
common/os/windows/win32_exception.cpp
common/polling_filesystem_monitor.cpp
common/semaphore.h
common/thread_info.cpp
common/thread_info.h
core/StdAfx.h
core/consumer/frame_consumer.cpp
core/diagnostics/call_context.cpp
core/frame/audio_channel_layout.cpp
core/frame/frame.cpp
core/frame/frame_transform.cpp
core/producer/cg_proxy.cpp
core/producer/frame_producer.cpp
core/producer/layer.cpp
core/producer/media_info/in_memory_media_info_repository.cpp
core/producer/text/utils/freetype_library.cpp
core/producer/text/utils/freetype_library.h
core/system_info_provider.cpp
core/thumbnail_generator.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/ffmpeg/StdAfx.h
modules/ffmpeg/consumer/ffmpeg_consumer.cpp
modules/ffmpeg/ffmpeg.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/ffmpeg/producer/filter/audio_filter.cpp
modules/ffmpeg/producer/filter/filter.cpp
modules/ffmpeg/producer/muxer/frame_muxer.cpp
modules/flash/producer/flash_producer.cpp
modules/html/html.cpp
modules/html/producer/html_producer.cpp
modules/image/consumer/image_consumer.cpp
modules/oal/consumer/oal_consumer.cpp
modules/psd/psd_scene_producer.cpp
modules/reroute/producer/channel_producer.cpp
modules/screen/consumer/screen_consumer.cpp
protocol/osc/client.cpp
shell/main.cpp
shell/server.cpp

index 5ada8be5ebadfcb040173b2fc9f726d6d3cd071f..008471b2ec6ab2ad51c919fe9f555be8e2f73fa1 100644 (file)
@@ -49,7 +49,6 @@
 #include <boost/range.hpp>
 #include <boost/range/adaptors.hpp>
 #include <boost/range/algorithm.hpp>
-#include <boost/thread.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/xml_parser.hpp>
 
index 0fa41502392709a58880d3f45e870817abfb53e5..45160c4ab010c6af159f18cf59fded841393ed52 100644 (file)
@@ -44,7 +44,6 @@
 #include <tbb/concurrent_queue.h>
 
 #include <boost/range/algorithm_ext/erase.hpp>
-#include <boost/thread/future.hpp>
 
 #include <algorithm>
 #include <cstdint>
index 1e7ce2784dfae3bef9df157043ed9ec437947dcc..f761ad6a86a78e95d7c303b5b09aa69fc8dabb1d 100644 (file)
@@ -42,7 +42,6 @@
 #include <GL/glew.h>
 
 #include <boost/range/algorithm_ext/erase.hpp>
-#include <boost/thread/future.hpp>
 
 #include <algorithm>
 #include <vector>
index 73ff927964f768ffc23992eea3253cdace9f3c0b..aadd079c04731605f6ca9895055ac7e3c9a3483c 100644 (file)
@@ -32,8 +32,6 @@
 
 #include <tbb/atomic.h>
 
-#include <boost/thread/future.hpp>
-
 namespace caspar { namespace accelerator { namespace ogl {
        
 static GLenum FORMAT[] = {0, GL_RED, GL_RG, GL_BGR, GL_BGRA};
index 56e7f9c4be064c76c237d22dca59c44bc27eb7b3..750083b0991e7ae51ad7401ad897bcc82e8cb0c0 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "semaphore.h"
 
-#include <boost/thread/mutex.hpp>
 #include <boost/noncopyable.hpp>
 
 namespace caspar {
@@ -53,7 +52,7 @@ public:
        typedef typename Q::value_type value_type;
        typedef unsigned int size_type;
 private:
-       mutable boost::mutex    capacity_mutex_;
+       mutable std::mutex      capacity_mutex_;
        size_type                               capacity_;
        semaphore                               space_available_                = capacity_;
        semaphore                               elements_available_             = 0;
@@ -138,7 +137,7 @@ public:
         */
        void set_capacity(size_type capacity)
        {
-               boost::unique_lock<boost::mutex> lock (capacity_mutex_);
+               std::unique_lock<std::mutex> lock (capacity_mutex_);
 
                if (capacity_ < capacity)
                {
@@ -162,7 +161,7 @@ public:
         */
        size_type capacity() const
        {
-               boost::unique_lock<boost::mutex> lock (capacity_mutex_);
+               std::unique_lock<std::mutex> lock (capacity_mutex_);
 
                return capacity_;
        }
index 33c5b989b61177213d0a55c70d6738e85283fc5d..4b41980bbbdaddb4f1eb7700b4e703f3752bcdff 100644 (file)
@@ -26,8 +26,6 @@
 
 #include <tbb/concurrent_queue.h>
 
-#include <boost/thread/mutex.hpp>
-
 #include "semaphore.h"
 
 namespace caspar {
@@ -49,7 +47,7 @@ private:
        size_type                                                                                                               capacity_;
        semaphore                                                                                                               space_available_        { capacity_ };
        semaphore                                                                                                               elements_available_     { 0u };
-       mutable boost::mutex                                                                                    capacity_mutex_;
+       mutable std::mutex                                                                                      capacity_mutex_;
 public:
        /**
         * Constructor.
@@ -189,7 +187,7 @@ public:
         */
        void set_capacity(size_type capacity)
        {
-               boost::unique_lock<boost::mutex> lock(capacity_mutex_);
+               std::unique_lock<std::mutex> lock(capacity_mutex_);
 
                if (capacity_ < capacity)
                {
@@ -211,7 +209,7 @@ public:
         */
        size_type capacity() const
        {
-               boost::unique_lock<boost::mutex> lock (capacity_mutex_);
+               std::unique_lock<std::mutex> lock (capacity_mutex_);
 
                return capacity_;
        }
index 539a92be63dd3016ddce77ebc189d00b0100a729..cfd6d74a297b14d021f2fef519a93fe73ffb75bf 100644 (file)
 
 #include "../linq.h"
 
-#include <boost/thread.hpp>
-
 #include <tbb/spin_mutex.h>
 
+#include <mutex>
 #include <vector>
 
 namespace caspar { namespace diagnostics {
@@ -53,12 +52,12 @@ std::tuple<float, float, float, float> color(int code)
 }
 
 typedef std::vector<spi::sink_factory_t> sink_factories_t;
-static boost::mutex g_sink_factories_mutex;
+static std::mutex g_sink_factories_mutex;
 static sink_factories_t g_sink_factories;
 
 std::vector<spl::shared_ptr<spi::graph_sink>> create_sinks()
 {
-       boost::lock_guard<boost::mutex> lock(g_sink_factories_mutex);
+       std::lock_guard<std::mutex> lock(g_sink_factories_mutex);
 
        return cpplinq::from(g_sink_factories)
                .select([](const spi::sink_factory_t& s){ return s(); })
@@ -133,11 +132,11 @@ namespace spi {
 
 void register_sink_factory(sink_factory_t factory)
 {
-       boost::lock_guard<boost::mutex> lock(g_sink_factories_mutex);
+       std::lock_guard<std::mutex> lock(g_sink_factories_mutex);
 
        g_sink_factories.push_back(std::move(factory));
 }
 
 }
 
-}}
\ No newline at end of file
+}}
index 3c27669689dfc96906079abe85df61d032434c7f..08e3bfb3554bc53d429e833a9aecf485cf34bc30 100644 (file)
@@ -34,7 +34,6 @@
 #include <boost/property_tree/xml_parser.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/filesystem/fstream.hpp>
-#include <boost/thread/once.hpp>
 
 #include <functional>
 #include <iostream>
index 7257e79971162bb2fa5663e527e1818bfa975884..e6adf051e54ece1bfb0e2a2d3ee62f84faccc736 100644 (file)
 
 #include "except.h"
 
-#include <boost/thread/tss.hpp>
 #include <boost/algorithm/string/join.hpp>
 
 namespace {
 
-boost::thread_specific_ptr<std::list<std::string>>& context_stacks_per_thread()
+std::list<std::string>& context_stacks_per_thread()
 {
-       static boost::thread_specific_ptr<std::list<std::string>> instances;
+       static thread_local std::list<std::string> instances;
 
        return instances;
 }
@@ -41,15 +40,7 @@ namespace caspar {
 
 std::list<std::string>& context_stack_for_thread()
 {
-       auto local = context_stacks_per_thread().get();
-
-       if (!local)
-       {
-               local = new std::list<std::string>();
-               context_stacks_per_thread().reset(local);
-       }
-
-       return *local;
+       return context_stacks_per_thread();
 }
 
 std::string get_context()
index d6949615ac360c8b94671568a46eed750178f3db..9ec5c12311f97f0876fec34d02595de81654fcb5 100644 (file)
 #include <tbb/atomic.h>
 #include <tbb/concurrent_priority_queue.h>
 
-#include <boost/thread.hpp>
 #include <boost/optional.hpp>
 
 #include <functional>
 #include <future>
+#include <thread>
 
 namespace caspar {
 enum class task_priority
@@ -57,7 +57,7 @@ class executor final
 
        const std::wstring      name_;
        tbb::atomic<bool>       is_running_;
-       boost::thread           thread_;
+       std::thread             thread_;
        function_queue_t        execution_queue_;
        tbb::atomic<bool>       currently_in_task_;
 
@@ -75,7 +75,7 @@ public:
        {
                is_running_ = true;
                currently_in_task_ = false;
-               thread_ = boost::thread([this]{run();});
+               thread_ = std::thread([this]{run();});
        }
 
        ~executor()
@@ -178,7 +178,7 @@ public:
 
        bool is_current() const
        {
-               return boost::this_thread::get_id() == thread_.get_id();
+               return std::this_thread::get_id() == thread_.get_id();
        }
 
        bool is_currently_in_task() const
index 65bea20b56b42e347a2fe89a841fa2b7d4adb5f1..52498f9fe4992ab7675737cbba41ec7bdc5fb9d4 100644 (file)
@@ -1,6 +1,5 @@
 #pragma once
 
-#include <boost/thread/mutex.hpp>
 #include <boost/function.hpp>
 #include <boost/optional.hpp>
 
@@ -54,4 +53,4 @@ static std::future<void> make_ready_future()
        return p.get_future();
 }
 
-}
\ No newline at end of file
+}
index 2501182b665958d03548416d8fd5f91ba444df65..70b4c362b5ea7b3a47cda2d6031b4053c7b8eb79 100644 (file)
@@ -1,13 +1,13 @@
 #pragma once
 
-#include <boost/thread/lock_guard.hpp>
+#include <mutex>
 
 namespace caspar {
 
 template<typename T, typename F>
 auto lock(T& mutex, F&& func) -> decltype(func())
 {
-       boost::lock_guard<T> lock(mutex);
+       std::lock_guard<T> lock(mutex);
        return func();
 }
 
index 74fa7cd542fddc87e3c6168bb8341a720094dfad..63641a4efeaed8674b5634a3939b07b26bbd77df 100644 (file)
@@ -29,7 +29,9 @@
 
 #include <ios>
 #include <iomanip>
+#include <mutex>
 #include <string>
+#include <thread>
 #include <ostream>
 
 #include <boost/shared_ptr.hpp>
@@ -56,7 +58,6 @@
 #include <boost/bind.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/property_tree/ptree.hpp>
-#include <boost/thread/mutex.hpp>
 
 #include <tbb/atomic.h>
 
@@ -248,9 +249,9 @@ std::shared_ptr<void> add_preformatted_line_sink(std::function<void(std::string
        });
 }
 
-boost::mutex& get_filter_mutex()
+std::mutex& get_filter_mutex()
 {
-       static boost::mutex instance;
+       static std::mutex instance;
 
        return instance;
 }
@@ -283,7 +284,7 @@ void set_log_filter()
 
 void set_log_level(const std::wstring& lvl)
 {
-       boost::lock_guard<boost::mutex> lock(get_filter_mutex());
+       std::lock_guard<std::mutex> lock(get_filter_mutex());
 
        if (boost::iequals(lvl, L"trace"))
                get_level() = boost::log::trivial::trace;
@@ -312,7 +313,7 @@ void set_log_category(const std::wstring& cat, bool enabled)
        else
                return; // Ignore
 
-       boost::lock_guard<boost::mutex> lock(get_filter_mutex());
+       std::lock_guard<std::mutex> lock(get_filter_mutex());
        auto& disabled_categories = get_disabled_categories();
 
        if (enabled)
index 9a700740c4d95ef46cdde1d9a6dddbe2895c5034..707147362b57014628843f0d4b2d690f78763051 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "../../prec_timer.h"
 
-#include <boost/thread.hpp>
 #include <boost/chrono/system_clocks.hpp>
 
 #include <time.h>
index 0a65c5cebb66b9d83b022f2de6ee4bfb836be3a8..267696f03eb1e39fe5043232317d87a2451c2e74 100644 (file)
@@ -2,7 +2,6 @@
 
 #include "win32_exception.h"
 
-#include <boost/thread.hpp>
 #include <boost/lexical_cast.hpp>
 
 #include "../../thread_info.h"
@@ -38,7 +37,7 @@ inline void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName)
 
 bool& installed_for_thread()
 {
-       static boost::thread_specific_ptr<bool> installed;
+       static thread_local bool installed;
 
        auto for_thread = installed.get();
 
index 74962590b1884174f189dbb0275be81fcd7841de..305e0b0c3b24faec62f38dde357ca4e1d8b61d46 100644 (file)
@@ -29,7 +29,6 @@
 #include <cstdint>
 
 #include <boost/asio.hpp>
-#include <boost/thread.hpp>
 #include <boost/filesystem/fstream.hpp>
 #include <boost/filesystem/convenience.hpp>
 
index ad6de09f829577eccf3d16bb94484839e9988bc7..c69960b3ed69ee0bafe1b871a6bacb36c92d7df1 100644 (file)
 #include <cmath>
 
 #include <boost/noncopyable.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
 
 #include <map>
+#include <mutex>
 #include <queue>
 #include <functional>
 
+#include <boost/thread/condition_variable.hpp>
+
 namespace caspar {
 
 /**
@@ -38,7 +39,7 @@ namespace caspar {
  */
 class semaphore : boost::noncopyable
 {
-       mutable boost::mutex                                                                            mutex_;
+       mutable std::mutex                                                                              mutex_;
        unsigned int                                                                                            permits_;
        boost::condition_variable_any                                                           permits_available_;
        std::map<unsigned int, std::queue<std::function<void()>>>       callbacks_per_requested_permits_;
@@ -58,7 +59,7 @@ public:
         */
        void release()
        {
-               boost::unique_lock<boost::mutex> lock(mutex_);
+               std::unique_lock<std::mutex> lock(mutex_);
 
                ++permits_;
 
@@ -73,7 +74,7 @@ public:
         */
        void release(unsigned int permits)
        {
-               boost::unique_lock<boost::mutex> lock(mutex_);
+               std::unique_lock<std::mutex> lock(mutex_);
 
                permits_ += permits;
 
@@ -87,7 +88,7 @@ public:
         */
        void acquire()
        {
-               boost::unique_lock<boost::mutex> lock(mutex_);
+               std::unique_lock<std::mutex> lock(mutex_);
 
                while (permits_ == 0u)
                {
@@ -105,7 +106,7 @@ public:
         */
        void acquire(unsigned int permits)
        {
-               boost::unique_lock<boost::mutex> lock(mutex_);
+               std::unique_lock<std::mutex> lock(mutex_);
                auto num_acquired = 0u;
 
                while (true)
@@ -132,7 +133,7 @@ public:
        */
        void acquire(unsigned int permits, std::function<void()> acquired_callback)
        {
-               boost::unique_lock<boost::mutex> lock(mutex_);
+               std::unique_lock<std::mutex> lock(mutex_);
 
                if (permits_ >= permits)
                {
@@ -157,7 +158,7 @@ public:
        template <typename Rep, typename Period>
        bool try_acquire(unsigned int permits, const boost::chrono::duration<Rep, Period>& timeout)
        {
-               boost::unique_lock<boost::mutex> lock(mutex_);
+               std::unique_lock<std::mutex> lock(mutex_);
                auto num_acquired = 0u;
 
                while (true)
@@ -191,7 +192,7 @@ public:
         */
        bool try_acquire()
        {
-               boost::unique_lock<boost::mutex> lock(mutex_);
+               std::unique_lock<std::mutex> lock(mutex_);
 
                if (permits_ == 0u)
                        return false;
@@ -209,7 +210,7 @@ public:
         */
        unsigned int permits() const
        {
-               boost::unique_lock<boost::mutex> lock(mutex_);
+               std::unique_lock<std::mutex> lock(mutex_);
 
                return permits_;
        }
index 9277dd43164b8f68a12cb4fce1453768f9288da0..77ad1b022854c4ac2873bacf9ed7376a802b0ea5 100644 (file)
 #include "os/threading.h"
 
 #include <map>
+#include <mutex>
 
 #include <boost/thread/tss.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/lock_guard.hpp>
-#include <boost/lexical_cast.hpp>
 
 namespace caspar {
 
 class enumerable_thread_infos
 {
-       boost::mutex                                                                                            mutex_;
+       std::mutex                                                                                              mutex_;
        std::map<void*, std::weak_ptr<thread_info>>                                     enumerable_;
        boost::thread_specific_ptr<std::shared_ptr<thread_info>>        infos_;
 public:
@@ -48,7 +46,7 @@ public:
 
        std::vector<spl::shared_ptr<thread_info>> get_thread_infos()
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                std::vector<spl::shared_ptr<thread_info>> result;
                result.reserve(enumerable_.size());
@@ -82,13 +80,13 @@ public:
                        std::unique_ptr<thread_info> p(new thread_info);
                        local = new std::shared_ptr<thread_info>(p.get(), [this](thread_info* p)
                        {
-                               boost::lock_guard<boost::mutex> lock(mutex_);
+                               std::lock_guard<std::mutex> lock(mutex_);
                                enumerable_.erase(p);
                                delete p;
                        });
                        p.release();
                        infos_.reset(local);
-                       boost::lock_guard<boost::mutex> lock(mutex_);
+                       std::lock_guard<std::mutex> lock(mutex_);
                        enumerable_.insert(std::make_pair(local->get(), *local));
                }
 
index 05187862f562cf3dc3a316ee50e012797a9841a3..097c0b31a5b3bb8d69beb7ebe154e3c45e85b2ad 100644 (file)
@@ -29,8 +29,6 @@
 
 #include <tbb/atomic.h>
 
-#include <boost/thread/thread.hpp>
-
 namespace caspar {
 
 struct thread_info
index 2173fffd7e3dfc8c81faada327054c08ad099991..7e2df573c17d2d78db3209c7e744031ce5b50ac8 100644 (file)
@@ -51,7 +51,6 @@
 #include <boost/range/adaptors.hpp>
 #include <boost/range/algorithm.hpp>
 #include <boost/algorithm/string.hpp>
-#include <boost/thread.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/xml_parser.hpp>
 
index 477998ace7cc2c9a2cb20d80e835e12c41642925..937d25073a7285946bddf192c9fd571053541f7e 100644 (file)
 #include <core/frame/frame.h>
 #include <core/frame/audio_channel_layout.h>
 
-#include <boost/thread.hpp>
-
 #include <future>
 #include <vector>
 #include <map>
+#include <thread>
 
 namespace caspar { namespace core {
 
@@ -104,7 +103,7 @@ public:
                CASPAR_VERIFY(counter < 8);
 
                auto consumer = new std::shared_ptr<frame_consumer>(std::move(consumer_));
-               boost::thread([=]
+               std::thread([=]
                {
                        std::unique_ptr<std::shared_ptr<frame_consumer>> pointer_guard(consumer);
                        auto str = (*consumer)->print();
index d68912bbf12f675598bb97608f99d4213d17a103..a04a7c67ff17978f32c7ffc1a8f66f31809737c2 100644 (file)
 
 #include "call_context.h"
 
-#include <boost/thread/tss.hpp>
 #include <boost/lexical_cast.hpp>
 
 namespace caspar { namespace core { namespace diagnostics {
 
 call_context& call_context::for_thread()
 {
-       static boost::thread_specific_ptr<call_context> contexts;
+       static call_context *contexts = nullptr;
 
-       auto local = contexts.get();
-
-       if (!local)
+       if (!contexts)
        {
-               local = new call_context;
-               contexts.reset(local);
+               contexts = new call_context;
        }
 
-       return *local;
+       return *contexts;
 }
 
 std::wstring call_context::to_string() const
index 956830d857e3d84e0fca9f795f83369ae735cc4a..996101702ab433a47de86b15b08a10ef34c97c39 100644 (file)
 #include <boost/algorithm/string/join.hpp>
 #include <boost/range/algorithm/equal.hpp>
 #include <boost/lexical_cast.hpp>
-#include <boost/thread/mutex.hpp>
 #include <boost/property_tree/ptree.hpp>
 
 #include <map>
+#include <mutex>
 
 namespace caspar { namespace core {
 
@@ -107,7 +107,7 @@ bool operator!=(const audio_channel_layout& lhs, const audio_channel_layout& rhs
 
 struct audio_channel_layout_repository::impl
 {
-       mutable boost::mutex                                                    mutex_;
+       mutable std::mutex                                                      mutex_;
        std::map<std::wstring, audio_channel_layout>    layouts_;
 };
 
@@ -119,7 +119,7 @@ audio_channel_layout_repository::audio_channel_layout_repository()
 void audio_channel_layout_repository::register_layout(std::wstring name, audio_channel_layout layout)
 {
        auto& self = *impl_;
-       boost::lock_guard<boost::mutex> lock(self.mutex_);
+       std::lock_guard<std::mutex> lock(self.mutex_);
 
        boost::to_upper(name);
        self.layouts_.insert(std::make_pair(std::move(name), std::move(layout)));
@@ -128,7 +128,7 @@ void audio_channel_layout_repository::register_layout(std::wstring name, audio_c
 void audio_channel_layout_repository::register_all_layouts(const boost::property_tree::wptree& layouts)
 {
        auto& self = *impl_;
-       boost::lock_guard<boost::mutex> lock(self.mutex_);
+       std::lock_guard<std::mutex> lock(self.mutex_);
 
        for (auto& layout : layouts | welement_context_iteration)
        {
@@ -149,7 +149,7 @@ void audio_channel_layout_repository::register_all_layouts(const boost::property
 boost::optional<audio_channel_layout> audio_channel_layout_repository::get_layout(const std::wstring& name) const
 {
        auto& self = *impl_;
-       boost::lock_guard<boost::mutex> lock(self.mutex_);
+       std::lock_guard<std::mutex> lock(self.mutex_);
 
        auto found = self.layouts_.find(boost::to_upper_copy(name));
 
@@ -168,7 +168,7 @@ spl::shared_ptr<audio_channel_layout_repository> audio_channel_layout_repository
 
 struct audio_mix_config_repository::impl
 {
-       mutable boost::mutex                                                                                    mutex_;
+       mutable std::mutex                                                                                      mutex_;
        std::map<std::wstring, std::map<std::wstring, std::wstring>>    from_to_configs_;
 };
 
@@ -183,7 +183,7 @@ void audio_mix_config_repository::register_config(
                const std::wstring& mix_config)
 {
        auto& self = *impl_;
-       boost::lock_guard<boost::mutex> lock(self.mutex_);
+       std::lock_guard<std::mutex> lock(self.mutex_);
        
        for (auto& to_type : to_types)
                self.from_to_configs_[boost::to_upper_copy(from_type)][boost::to_upper_copy(to_type)] = mix_config;
@@ -192,7 +192,7 @@ void audio_mix_config_repository::register_config(
 void audio_mix_config_repository::register_all_configs(const boost::property_tree::wptree& configs)
 {
        auto& self = *impl_;
-       boost::lock_guard<boost::mutex> lock(self.mutex_);
+       std::lock_guard<std::mutex> lock(self.mutex_);
 
        for (auto& config : configs | welement_context_iteration)
        {
@@ -224,7 +224,7 @@ boost::optional<std::wstring> audio_mix_config_repository::get_config(
                const std::wstring& to_type) const
 {
        auto& self = *impl_;
-       boost::lock_guard<boost::mutex> lock(self.mutex_);
+       std::lock_guard<std::mutex> lock(self.mutex_);
 
        auto from_found = self.from_to_configs_.find(boost::to_upper_copy(from_type));
 
index 2feb67ec4dcb2eeaef4091219bf18cdcdb10286f..214d7895243c6f3f58b01989bccfdd3158c3dc0c 100644 (file)
@@ -38,7 +38,6 @@
 #include <vector>
 
 #include <boost/lexical_cast.hpp>
-#include <boost/thread/future.hpp>
 
 namespace caspar { namespace core {
 
index a7a4ea186ea7f0f354d57035f64f315d36844ee4..e4f0bed6ebd8520b19b3c9017b88466f521fd5fd 100644 (file)
 
 #include "../StdAfx.h"
 
+#include <thread>
+
 #include "frame_transform.h"
 
 #include <boost/range/algorithm/equal.hpp>
-#include <boost/thread.hpp>
 
 namespace caspar { namespace core {
 
@@ -327,24 +328,21 @@ boost::optional<core::chroma::legacy_type> get_chroma_mode(const std::wstring& s
 
 namespace detail {
 
-boost::thread_specific_ptr<double>& get_thread_local_aspect_ratio()
-{
-       static boost::thread_specific_ptr<double> aspect_ratio;
-
-       if (!aspect_ratio.get())
-               aspect_ratio.reset(new double(1.0));
+static thread_local double aspect_ratio = 1.0;
 
+double get_thread_local_aspect_ratio()
+{
        return aspect_ratio;
 }
 
-void set_current_aspect_ratio(double aspect_ratio)
+void set_current_aspect_ratio(double aspect_ratio_arg)
 {
-       *get_thread_local_aspect_ratio() = aspect_ratio;
+       aspect_ratio = aspect_ratio_arg;
 }
 
 double get_current_aspect_ratio()
 {
-       return *get_thread_local_aspect_ratio();
+       return aspect_ratio;
 }
 
 }}}
index df8578ee44eb3937ac83416074910eaceb1a76f8..bda54ae771fcd9a6ced34d736f5b6f5055158a1d 100644 (file)
@@ -37,8 +37,6 @@
 #include <common/os/filesystem.h>
 #include <common/future.h>
 
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/lock_guard.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/optional.hpp>
@@ -84,7 +82,7 @@ private:
                bool                                    reusable_producer_instance;
        };
 
-       mutable boost::mutex                    mutex_;
+       mutable std::mutex                      mutex_;
        std::map<std::wstring, record>  records_by_extension_;
 public:
        void register_cg_producer(
@@ -95,7 +93,7 @@ public:
                        cg_producer_factory producer_factory,
                        bool reusable_producer_instance)
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                record rec
                {
@@ -128,7 +126,7 @@ public:
        {
                auto producer_name = producer->name();
 
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                for (auto& elem : records_by_extension_)
                {
@@ -185,7 +183,7 @@ public:
 
                auto basepath = path(env::template_folder()) / path(filename);
 
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                for (auto& rec : records_by_extension_)
                {
@@ -201,7 +199,7 @@ public:
 
        bool is_cg_extension(const std::wstring& extension) const
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                return records_by_extension_.find(extension) != records_by_extension_.end();
        }
@@ -222,7 +220,7 @@ private:
 
                auto basepath = path(env::template_folder()) / path(filename);
 
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                for (auto& rec : records_by_extension_)
                {
index de25a488e792be9a12a95192375557188a4634e4..a840084800933eb282bedcdb292dabd857e76b73 100644 (file)
@@ -37,8 +37,6 @@
 #include <common/future.h>
 #include <common/memory.h>
 
-#include <boost/thread.hpp>
-
 namespace caspar { namespace core {
 struct frame_producer_registry::impl
 {
index da9627f57b4fac1d7c7dac6f67ca206de80c49ec..cef464d0a22c8fd5d1b3ec826464b4d6a3c868be 100644 (file)
@@ -30,7 +30,6 @@
 #include "../frame/frame_transform.h"
 
 #include <boost/optional.hpp>
-#include <boost/thread/future.hpp>
 
 namespace caspar { namespace core {
 
index 662dc0d9870adbb7d13500292828af65634c2df3..d8b204dc9b7abc574063851d6eec0b2c79df322e 100644 (file)
@@ -24,9 +24,9 @@
 #include "in_memory_media_info_repository.h"
 
 #include <map>
+#include <mutex>
 #include <vector>
 
-#include <boost/thread/mutex.hpp>
 #include <boost/foreach.hpp>
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string/case_conv.hpp>
@@ -38,20 +38,20 @@ namespace caspar { namespace core {
 
 class in_memory_media_info_repository : public media_info_repository
 {
-       boost::mutex mutex_;
+       std::mutex mutex_;
        std::map<std::wstring, boost::optional<media_info>> info_by_file_;
        std::vector<media_info_extractor> extractors_;
 public:
        virtual void register_extractor(media_info_extractor extractor) override
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                extractors_.push_back(extractor);
        }
 
        virtual boost::optional<media_info> get(const std::wstring& file) override
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                auto iter = info_by_file_.find(file);
 
@@ -84,7 +84,7 @@ public:
 
        virtual void remove(const std::wstring& file) override
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                info_by_file_.erase(file);
        }
index 1eb1cc137dc86989a40c9e7952f3e53818fa9f50..70c8a9c9c158d3e9113f8b85fcd5a19b45ecfd84 100644 (file)
 
 #include "freetype_library.h"
 
-#include <boost/thread/tss.hpp>
+#include <memory>
 
 namespace caspar { namespace core { namespace text {
 
-spl::shared_ptr<std::remove_pointer<FT_Library>::type> get_lib_for_thread()
+std::shared_ptr<std::remove_pointer<FT_Library>::type> get_lib_for_thread()
 {
        typedef std::remove_pointer<FT_Library>::type non_ptr_type;
-       static boost::thread_specific_ptr<spl::shared_ptr<non_ptr_type>> libs;
+       static thread_local std::shared_ptr<non_ptr_type> libs;
 
-       auto result = libs.get();
-
-       if (!result)
+       if (libs.get() == nullptr)
        {
                FT_Library raw_lib;
 
                if (FT_Init_FreeType(&raw_lib))
                        CASPAR_THROW_EXCEPTION(freetype_exception() << msg_info("Failed to initialize freetype"));
 
-               auto lib = spl::shared_ptr<non_ptr_type>(raw_lib, FT_Done_FreeType);
-               result = new spl::shared_ptr<non_ptr_type>(std::move(lib));
-
-               libs.reset(result);
+               libs = spl::shared_ptr<non_ptr_type>(raw_lib, FT_Done_FreeType);
        }
 
-       return *result;
+       return libs;
 }
 
-spl::shared_ptr<std::remove_pointer<FT_Face>::type> get_new_face(
+std::shared_ptr<std::remove_pointer<FT_Face>::type> get_new_face(
                const std::string& font_file, const std::string& font_name)
 {
        if (font_file.empty())
index fe33fbda62b3ff0d2350e6f6ad6f27ff81b370a6..1463f936715a6afb189b4e2f0670cf694e064180 100644 (file)
@@ -27,6 +27,7 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+#include <memory>
 #include <string>
 #include <type_traits>
 
@@ -35,7 +36,7 @@ namespace caspar { namespace core { namespace text {
 struct freetype_exception : virtual caspar_exception { };
 struct expected_freetype_exception : virtual user_error { };
 
-spl::shared_ptr<std::remove_pointer<FT_Library>::type> get_lib_for_thread();
-spl::shared_ptr<std::remove_pointer<FT_Face>::type> get_new_face(const std::string& font_file, const std::string& font_name = "");
+std::shared_ptr<std::remove_pointer<FT_Library>::type> get_lib_for_thread();
+std::shared_ptr<std::remove_pointer<FT_Face>::type> get_new_face(const std::string& font_file, const std::string& font_name = "");
 
 }}}
index f23aa06f5070865c68f594eec6e8834effdb0f5b..5fbd608a848ace08822eb92a48d27578351af9f2 100644 (file)
 #include "system_info_provider.h"
 
 #include <boost/property_tree/ptree.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/lock_guard.hpp>
 #include <boost/algorithm/string/case_conv.hpp>
 
-#include <vector>
 #include <map>
+#include <mutex>
+#include <vector>
 
 namespace caspar { namespace core {
 
 struct system_info_provider_repository::impl
 {
-       mutable boost::mutex                                            mutex_;
+       mutable std::mutex                                              mutex_;
        std::vector<system_info_provider>                       info_providers_;
        std::map<std::wstring, version_provider>        version_providers_;
 
        void register_system_info_provider(system_info_provider provider)
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                info_providers_.push_back(std::move(provider));
        }
 
        void register_version_provider(const std::wstring& version_name, version_provider provider)
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                version_providers_.insert(std::make_pair(boost::algorithm::to_lower_copy(version_name), std::move(provider)));
        }
 
        void fill_information(boost::property_tree::wptree& info) const
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
 
                for (auto& provider : info_providers_)
                        provider(info);
@@ -63,7 +62,7 @@ struct system_info_provider_repository::impl
 
        std::wstring get_version(const std::wstring& version_name) const
        {
-               boost::lock_guard<boost::mutex> lock(mutex_);
+               std::lock_guard<std::mutex> lock(mutex_);
                
                auto found = version_providers_.find(boost::algorithm::to_lower_copy(version_name));
 
index b2a00e957541fb2af27c0cedb2559086872094a0..09b61de6cdb82b9fae38fc1bf6fd1ff775b6c0bf 100644 (file)
 #include <iterator>
 #include <set>
 #include <future>
+#include <thread>
 
-#include <boost/thread.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/thread.hpp>
 
 #include <tbb/atomic.h>
 
@@ -67,7 +68,7 @@ struct thumbnail_output
                int current_sleep = sleep_millis;
 
                if (current_sleep > 0)
-                       boost::this_thread::sleep_for(boost::chrono::milliseconds(current_sleep));
+                       std::this_thread::sleep_for(std::chrono::milliseconds(current_sleep));
 
                on_send(std::move(frame));
                on_send = nullptr;
index 9a0cca49eb4bf66b2fbc356885415079a178e005..3e880adc6f9d80e05474ca2a63c40174f07ce976 100644 (file)
@@ -55,7 +55,6 @@
 #include <boost/lexical_cast.hpp>
 #include <boost/circular_buffer.hpp>
 #include <boost/property_tree/ptree.hpp>
-#include <boost/thread/mutex.hpp>
 
 #include <future>
 
index 96b404275a4b41ffe5d4ae2e5a9c8ffe93983109..b009dbb1cdb969ed504f381e1a2a9af42503bb7b 100644 (file)
 #include <boost/range/algorithm_ext/push_back.hpp>
 #include <boost/range/iterator_range.hpp>
 #include <boost/regex.hpp>
-#include <boost/thread/condition_variable.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/once.hpp>
-#include <boost/thread/thread.hpp>
 #include <cstdint>
 #include <cstdio>
 #include <deque>
index 4cfa88fad01844fec876cf98d2a3604a63681439..702ebdfad472cb3407a700aeadd695ef4b721523 100644 (file)
@@ -45,6 +45,7 @@
 #include <tbb/parallel_for.h>
 
 #include <numeric>
+#include <thread>
 
 #pragma warning(push)
 #pragma warning(disable: 4244)
@@ -661,7 +662,7 @@ private:
                                        avfilter_graph_free(&p);
                                });
 
-               video_graph_->nb_threads  = boost::thread::hardware_concurrency()/2;
+               video_graph_->nb_threads  = std::thread::hardware_concurrency()/2;
                video_graph_->thread_type = AVFILTER_THREAD_SLICE;
 
                const auto sample_aspect_ratio =
@@ -987,7 +988,7 @@ private:
                                                        filt_frame,
                                                        token);
 
-                                       boost::this_thread::yield(); // TODO:
+                                       std::this_thread::yield(); // TODO:
                                });
                        }
                }
@@ -1010,7 +1011,7 @@ private:
                                                                nullptr,
                                                                token))
                                                {
-                                                       boost::this_thread::yield(); // TODO:
+                                                       std::this_thread::yield(); // TODO:
                                                }
                                        }
                                }
index ea7f73741497bcdfca2ec604e7d13e6ebac29c64..aa0b6419754ef54ac9f7f0252250d7104a08ced9 100644 (file)
@@ -38,7 +38,6 @@
 #include <core/system_info_provider.h>
 
 #include <boost/property_tree/ptree.hpp>
-#include <boost/thread/tss.hpp>
 #include <boost/bind.hpp>
 
 #include <tbb/recursive_mutex.h>
@@ -109,14 +108,7 @@ static void sanitize(uint8_t *line)
 
 void log_callback(void* ptr, int level, const char* fmt, va_list vl)
 {
-       static boost::thread_specific_ptr<bool> print_prefix_tss;
-       auto print_prefix = print_prefix_tss.get();
-
-       if (!print_prefix)
-       {
-               print_prefix = new bool(true);
-               print_prefix_tss.reset(print_prefix);
-       }
+       static thread_local bool print_prefix = true;
 
        char line[1024];
        AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
@@ -125,7 +117,7 @@ void log_callback(void* ptr, int level, const char* fmt, va_list vl)
        line[0]=0;
 
 #undef fprintf
-       if(*print_prefix && avc)
+       if(print_prefix && avc)
        {
                if (avc->parent_log_context_offset)
                {
@@ -138,7 +130,7 @@ void log_callback(void* ptr, int level, const char* fmt, va_list vl)
 
        std::vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);
 
-       *print_prefix = strlen(line) && line[strlen(line)-1] == '\n';
+       print_prefix = strlen(line) && line[strlen(line)-1] == '\n';
 
        sanitize((uint8_t*)line);
 
@@ -195,17 +187,8 @@ std::wstring swscale_version()
 }
 bool& get_quiet_logging_for_thread()
 {
-       static boost::thread_specific_ptr<bool> quiet_logging_for_thread;
-
-       auto local = quiet_logging_for_thread.get();
-
-       if (!local)
-       {
-               local = new bool(false);
-               quiet_logging_for_thread.reset(local);
-       }
-
-       return *local;
+       static thread_local bool quiet_logging_for_thread = false;
+       return quiet_logging_for_thread;
 }
 
 void enable_quiet_logging_for_thread()
index c0cbad5daf73aae79dcfafbf9a6f77807b71e3c1..1c57509b9979b23ad3bc5969479cb20617982cec 100644 (file)
@@ -314,12 +314,12 @@ public:
                                           // therefore no seeking should be necessary for the first frame.
                {
                        input_.seek(file_position > 1 ? file_position - 2: file_position).get();
-                       boost::this_thread::sleep_for(boost::chrono::milliseconds(40));
+                       std::this_thread::sleep_for(std::chrono::milliseconds(40));
                }
 
                for (int i = 0; i < NUM_RETRIES; ++i)
                {
-                       boost::this_thread::sleep_for(boost::chrono::milliseconds(40));
+                       std::this_thread::sleep_for(std::chrono::milliseconds(40));
 
                        auto frame = render_frame();
 
@@ -339,7 +339,7 @@ public:
                                {
                                        CASPAR_LOG(trace) << print() << L" adjusting to " << adjusted_seek;
                                        input_.seek(static_cast<uint32_t>(adjusted_seek) - 1).get();
-                                       boost::this_thread::sleep_for(boost::chrono::milliseconds(40));
+                                       std::this_thread::sleep_for(std::chrono::milliseconds(40));
                                }
                                else
                                        return frame.first;
index b9059309a334a19277e6e71ae02160912f5c9245..0478eef13a7424a5bd35044b6bb9135efb0ad3f8 100644 (file)
@@ -31,7 +31,6 @@
 #include <common/except.h>
 
 #include <boost/algorithm/string.hpp>
-#include <boost/thread.hpp>
 #include <boost/format.hpp>
 #include <boost/rational.hpp>
 
index 1b59b8e350b537f15bd1a4b694132b08b03b53d5..77c09f4890eb3102df5feeb969db0eac6d412618 100644 (file)
@@ -31,7 +31,6 @@
 #include <common/except.h>
 
 #include <boost/algorithm/string.hpp>
-#include <boost/thread.hpp>
 #include <boost/format.hpp>
 #include <boost/rational.hpp>
 
index d927763774e3196ba97df6b5107e29f65baefba8..81c25ba9e6ed7d581238760b3354a7ff6b934fa0 100644 (file)
@@ -58,10 +58,10 @@ extern "C"
 #include <common/assert.h>
 #include <boost/range/algorithm_ext/push_back.hpp>
 #include <boost/algorithm/string/predicate.hpp>
-#include <boost/thread/mutex.hpp>
 #include <boost/optional.hpp>
 
 #include <deque>
+#include <mutex>
 #include <queue>
 #include <vector>
 
@@ -149,7 +149,7 @@ struct frame_muxer::impl : boost::noncopyable
        const bool                                                                              multithreaded_filter_;
        bool                                                                                    force_deinterlacing_;
 
-       mutable boost::mutex                                                    out_framerate_mutex_;
+       mutable std::mutex                                                      out_framerate_mutex_;
        boost::rational<int>                                                    out_framerate_;
 
        impl(
@@ -353,7 +353,7 @@ struct frame_muxer::impl : boost::noncopyable
 
        boost::rational<int> out_framerate() const
        {
-               boost::lock_guard<boost::mutex> lock(out_framerate_mutex_);
+               std::lock_guard<std::mutex> lock(out_framerate_mutex_);
 
                return out_framerate_;
        }
@@ -452,7 +452,7 @@ private:
 
        void set_out_framerate(boost::rational<int> out_framerate)
        {
-               boost::lock_guard<boost::mutex> lock(out_framerate_mutex_);
+               std::lock_guard<std::mutex> lock(out_framerate_mutex_);
 
                bool changed = out_framerate != out_framerate_;
                out_framerate_ = std::move(out_framerate);
index c379d96a8bd5c7305c10a35407674b135d6edf5c..7a127961e8a8787d63a7ad2fc540f9022f3d4448 100644 (file)
@@ -52,7 +52,6 @@
 
 #include <boost/filesystem.hpp>
 #include <boost/property_tree/ptree.hpp>
-#include <boost/thread.hpp>
 #include <boost/timer.hpp>
 #include <boost/algorithm/string.hpp>
 
@@ -155,9 +154,9 @@ template_host get_template_host(const core::video_format_desc& desc)
        return template_host;
 }
 
-boost::mutex& get_global_init_destruct_mutex()
+std::mutex& get_global_init_destruct_mutex()
 {
-       static boost::mutex m;
+       static std::mutex m;
 
        return m;
 }
@@ -527,8 +526,8 @@ public:
                                if (nothing_rendered++ < MAX_NOTHING_RENDERED_RETRIES)
                                {
                                        // Flash player not ready with first frame, sleep to not busy-loop;
-                                       boost::this_thread::sleep(boost::posix_time::milliseconds(10));
-                                       boost::this_thread::yield();
+                                       std::this_thread::sleep(boost::posix_time::milliseconds(10));
+                                       std::this_thread::yield();
                                }
                                else
                                        return;
@@ -668,4 +667,4 @@ std::wstring find_template(const std::wstring& template_name)
        return L"";
 }
 
-}}
\ No newline at end of file
+}}
index cda96e0f5225ac1a00d0662a680f1653cdf79eaa..1ca1e5bd8f131aa7f947f500456c5f7336fc49fb 100644 (file)
 
 #include <core/producer/cg_proxy.h>
 
-#include <boost/thread.hpp>
 #include <boost/asio.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/foreach.hpp>
 #include <boost/timer.hpp>
 #include <boost/range/algorithm/remove_if.hpp>
-#include <boost/thread/future.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/log/trivial.hpp>
 #include <boost/property_tree/ptree.hpp>
index 36e27cd25811ba36061c9bb533f63858a72f9217..91f39d7cbae9e748243e0c81b949cc108ce14c30 100644 (file)
@@ -89,11 +89,11 @@ class html_client
        tbb::atomic<bool>                                               loaded_;
        tbb::atomic<bool>                                               removed_;
        std::queue<core::draw_frame>                    frames_;
-       mutable boost::mutex                                    frames_mutex_;
+       mutable std::mutex                                      frames_mutex_;
 
        core::draw_frame                                                last_frame_;
        core::draw_frame                                                last_progressive_frame_;
-       mutable boost::mutex                                    last_frame_mutex_;
+       mutable std::mutex                                      last_frame_mutex_;
 
        CefRefPtr<CefBrowser>                                   browser_;
 
index 2ad3f11387cdf5339066f96368fa4444a1f4dacf..784c314e347ffe575b79a0186eef54539fabb369 100644 (file)
@@ -36,7 +36,6 @@
 #include <core/help/help_repository.h>
 
 #include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/thread.hpp>
 #include <boost/algorithm/string.hpp>
 
 #include <tbb/concurrent_queue.h>
@@ -97,7 +96,7 @@ public:
        {
                auto filename = filename_;
 
-               boost::thread async([frame, filename]
+               std::thread async([frame, filename]
                {
                        ensure_gpf_handler_installed_for_thread("image-consumer");
 
index d7c010ea27cb9959d6e47e0ce08af382e8e58888..b2af5fb4b21e0e6cce72b794879631bfbd11f188 100644 (file)
@@ -43,7 +43,6 @@
 #include <boost/lexical_cast.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/timer.hpp>
-#include <boost/thread/once.hpp>
 #include <boost/algorithm/string.hpp>
 
 #include <tbb/concurrent_queue.h>
@@ -97,9 +96,9 @@ public:
 void init_device()
 {
        static std::unique_ptr<device> instance;
-       static boost::once_flag f = BOOST_ONCE_INIT;
+       static std::once_flag f;
 
-       boost::call_once(f, []{instance.reset(new device());});
+       std::call_once(f, []{instance.reset(new device());});
 }
 
 struct oal_consumer : public core::frame_consumer
index c9f8325f7b75a463845e22171c54c0855633e7c6..93cad2b649c60d6b904b20ada3d8890c1dd92590 100644 (file)
@@ -44,7 +44,6 @@
 #include <common/os/filesystem.h>
 
 #include <boost/filesystem.hpp>
-#include <boost/thread/future.hpp>
 #include <boost/algorithm/string.hpp>
 #include <boost/rational.hpp>
 
index 72402d821f052773009205f53e4ffa9ab3dc949f..aea1a73d59ba7c6c91d25f3431202212e5732aca 100644 (file)
@@ -37,7 +37,6 @@
 #include <core/frame/frame_factory.h>
 #include <core/video_format.h>
 
-#include <boost/thread/once.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/range/algorithm/copy.hpp>
@@ -97,9 +96,9 @@ public:
        static int next_consumer_index()
        {
                static tbb::atomic<int> consumer_index_counter;
-               static boost::once_flag consumer_index_counter_initialized;
+               static std::once_flag consumer_index_counter_initialized;
 
-               boost::call_once(consumer_index_counter_initialized, [&]()
+               std::call_once(consumer_index_counter_initialized, [&]()
                {
                        consumer_index_counter = 0;
                });
index 600fd2a2bd8eb9958a9b190a9a4d8fcd8e8f4e52..6713f26aac76ed7f145c1d3464f99d4c171535a1 100644 (file)
@@ -53,7 +53,6 @@
 #include <boost/circular_buffer.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/property_tree/ptree.hpp>
-#include <boost/thread.hpp>
 #include <boost/algorithm/string.hpp>
 
 #include <tbb/atomic.h>
@@ -140,7 +139,7 @@ struct screen_consumer : boost::noncopyable
        tbb::concurrent_bounded_queue<core::const_frame>        frame_buffer_;
        core::interaction_sink*                                                         sink_;
 
-       boost::thread                                                                           thread_;
+       std::thread                                                                             thread_;
        tbb::atomic<bool>                                                                       is_running_;
        tbb::atomic<int64_t>                                                            current_presentation_age_;
 
@@ -221,7 +220,7 @@ public:
                polling_event_ = false;
                is_running_ = true;
                current_presentation_age_ = 0;
-               thread_ = boost::thread([this]{run();});
+               thread_ = std::thread([this]{run();});
        }
 
        ~screen_consumer()
index 6c99cf4ada55b7a6dcf2d3e4f1d6b72844d3a996..ca6703eec88113d97931b4e135ca4592a434c609 100644 (file)
 
 #include <core/monitor/monitor.h>
 
+#include <condition_variable>
 #include <functional>
-#include <vector>
+#include <mutex>
+#include <thread>
 #include <unordered_map>
+#include <vector>
 
 #include <boost/asio.hpp>
-#include <boost/bind.hpp>
-#include <boost/thread.hpp>
 
 #include <tbb/spin_mutex.h>
 
@@ -139,18 +140,18 @@ struct client::impl : public spl::enable_shared_from_this<client::impl>, core::m
        std::map<udp::endpoint, int>                                    reference_counts_by_endpoint_;
 
        std::unordered_map<std::string, byte_vector>    updates_;
-       boost::mutex                                                                    updates_mutex_;                                                         
-       boost::condition_variable                                               updates_cond_;
+       std::mutex                                                                      updates_mutex_;                                                         
+       std::condition_variable                                         updates_cond_;
 
        tbb::atomic<bool>                                                               is_running_;
 
-       boost::thread                                                                   thread_;
+       std::thread                                                                     thread_;
        
 public:
        impl(std::shared_ptr<boost::asio::io_service> service)
                : service_(std::move(service))
                , socket_(*service_, udp::v4())
-               , thread_(boost::bind(&impl::run, this))
+               , thread_(std::bind(&impl::run, this))
        {
        }
 
@@ -193,7 +194,7 @@ public:
 private:
        void propagate(const core::monitor::message& msg)
        {
-               boost::lock_guard<boost::mutex> lock(updates_mutex_);
+               std::lock_guard<std::mutex> lock(updates_mutex_);
 
                try 
                {
@@ -240,7 +241,7 @@ private:
                                destinations.clear();
 
                                {                       
-                                       boost::unique_lock<boost::mutex> cond_lock(updates_mutex_);
+                                       std::unique_lock<std::mutex> cond_lock(updates_mutex_);
 
                                        if (!is_running_)
                                                return;
index b90bd40018219abba98dc17097a27fa220b08756..48537fb51194af938fe88c4e3edceb99c654129c 100644 (file)
@@ -58,8 +58,6 @@
 #include <boost/locale.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/algorithm/string/predicate.hpp>
-#include <boost/thread.hpp>
-#include <boost/thread/future.hpp>
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/algorithm/string/split.hpp>
 #include <boost/algorithm/string/classification.hpp>
@@ -251,7 +249,7 @@ bool run(const std::wstring& config_file_name, tbb::atomic<bool>& should_wait_fo
 
        // Use separate thread for the blocking console input, will be terminated
        // anyway when the main thread terminates.
-       boost::thread stdin_thread(std::bind(do_run, weak_amcp, std::ref(shutdown_server_now), std::ref(should_wait_for_keypress)));    //compiler didn't like lambda here...
+       std::thread stdin_thread(std::bind(do_run, weak_amcp, std::ref(shutdown_server_now), std::ref(should_wait_for_keypress)));      //compiler didn't like lambda here...
        stdin_thread.detach();
        bool should_restart = shutdown_server.get();
        amcp.reset();
@@ -360,9 +358,9 @@ int main(int argc, char** argv)
        {
                CASPAR_LOG_CURRENT_EXCEPTION();
                CASPAR_LOG(fatal) << L"Unhandled exception in main thread. Please report this error on the CasparCG forums (www.casparcg.com/forum).";
-               boost::this_thread::sleep_for(boost::chrono::milliseconds(1000));
+               std::this_thread::sleep_for(std::chrono::milliseconds(1000));
                std::wcout << L"\n\nCasparCG will automatically shutdown. See the log file located at the configured log-file folder for more information.\n\n";
-               boost::this_thread::sleep_for(boost::chrono::milliseconds(4000));
+               std::this_thread::sleep_for(std::chrono::milliseconds(4000));
        }
 
        return return_code;
index b3b42641c938f7826bb5cb7a8edc1c03b3298ec1..7fc1a1edc6d3a518aaf3e5c4d7e10ba75ff9bc04 100644 (file)
@@ -72,7 +72,6 @@
 #include <protocol/log/tcp_logger_protocol_strategy.h>
 
 #include <boost/algorithm/string.hpp>
-#include <boost/thread.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/property_tree/xml_parser.hpp>
@@ -81,6 +80,7 @@
 #include <tbb/atomic.h>
 
 #include <future>
+#include <thread>
 
 namespace caspar {
 
@@ -94,7 +94,7 @@ std::shared_ptr<boost::asio::io_service> create_running_io_service()
        // operations are posted.
        auto work = std::make_shared<boost::asio::io_service::work>(*service);
        auto weak_work = std::weak_ptr<boost::asio::io_service::work>(work);
-       auto thread = std::make_shared<boost::thread>([service, weak_work]
+       auto thread = std::make_shared<std::thread>([service, weak_work]
        {
                ensure_gpf_handler_installed_for_thread("asio-thread");
 
@@ -120,7 +120,7 @@ std::shared_ptr<boost::asio::io_service> create_running_io_service()
                                CASPAR_LOG(info) << "[asio] Shutting down global io_service.";
                                work.reset();
                                service->stop();
-                               if (thread->get_id() != boost::this_thread::get_id())
+                               if (thread->get_id() != std::this_thread::get_id())
                                        thread->join();
                                else
                                        thread->detach();
@@ -141,7 +141,7 @@ struct server::impl : boost::noncopyable
        std::vector<std::shared_ptr<void>>                                      predefined_osc_subscriptions_;
        std::vector<spl::shared_ptr<video_channel>>                     channels_;
        spl::shared_ptr<media_info_repository>                          media_info_repo_;
-       boost::thread                                                                           initial_media_info_thread_;
+       std::thread                                                                             initial_media_info_thread_;
        spl::shared_ptr<system_info_provider_repository>        system_info_provider_repo_;
        spl::shared_ptr<core::cg_producer_registry>                     cg_registry_;
        spl::shared_ptr<core::frame_producer_registry>          producer_registry_;
@@ -451,7 +451,7 @@ struct server::impl : boost::noncopyable
 
        void start_initial_media_info_scan()
        {
-               initial_media_info_thread_ = boost::thread([this]
+               initial_media_info_thread_ = std::thread([this]
                {
                        try
                        {