#include "os/stack_trace.h"
#include "utf.h"
+#include "thread_info.h"
#include <boost/log/trivial.hpp>
#include <boost/log/sources/global_logger_storage.hpp>
void add_file_sink(const std::wstring& folder);
-/*template< typename CharT, typename TraitsT >
-inline std::basic_ostream< CharT, TraitsT >& operator<< (
- std::basic_ostream< CharT, TraitsT >& strm, severity_level lvl)
-{
- if(lvl == trace)
- strm << "trace";
- else if(lvl == debug)
- strm << "debug";
- else if(lvl == info)
- strm << "info";
- else if(lvl == warning)
- strm << "warning";
- else if(lvl == error)
- strm << "error";
- else if(lvl == fatal)
- strm << "fatal";
- else
- strm << static_cast<int>(lvl);
-
- return strm;
-}*/
-
typedef boost::log::sources::wseverity_logger_mt<boost::log::trivial::severity_level> caspar_logger;
BOOST_LOG_INLINE_GLOBAL_LOGGER_INIT(logger, caspar_logger)
BOOST_LOG_SEV(::caspar::log::logger::get(), ::boost::log::trivial::lvl)
#define CASPAR_LOG_CALL_STACK() try{\
- CASPAR_LOG(info) << L"callstack:\n" << caspar::get_call_stack();\
+ CASPAR_LOG(info) << L"callstack (" << caspar::get_thread_info().name << L"):\n" << caspar::get_call_stack();\
}\
catch(...){}
#define CASPAR_LOG_CURRENT_EXCEPTION() try{\
- CASPAR_LOG(error) << caspar::u16(boost::current_exception_diagnostic_information()) << L"Caught at:\n" << caspar::get_call_stack();\
+ CASPAR_LOG(error) << caspar::u16(boost::current_exception_diagnostic_information()) << L"Caught at (" << caspar::get_thread_info().name << L"):\n" << caspar::get_call_stack();\
}\
catch(...){}
#include <common/utf.h>
#include <common/array.h>
#include <common/future.h>
+#include <common/os/general_protection_fault.h>
#include <core/consumer/frame_consumer.h>
#include <core/video_format.h>
boost::thread async([frame, filename]
{
+ ensure_gpf_handler_installed_for_thread("image-consumer");
+
try
{
auto filename2 = filename;
#include <common/future.h>
#include <common/timer.h>
#include <common/param.h>
+#include <common/os/general_protection_fault.h>
//#include <windows.h>
void run()
{
+ ensure_gpf_handler_installed_for_thread("screen-consumer-thread");
+
try
{
init();
#include <common/except.h>
#include <common/endian.h>
#include <common/cache_aligned_vector.h>
+#include <common/os/general_protection_fault.h>
+
#include <core/monitor/monitor.h>
#include <functional>
// http://stackoverflow.com/questions/14993000/the-most-reliable-and-efficient-udp-packet-size
const int SAFE_DATAGRAM_SIZE = 508;
+ ensure_gpf_handler_installed_for_thread("osc-sender-thread");
+
try
{
is_running_ = true;
{
CASPAR_LOG_CURRENT_EXCEPTION();
}
+ auto conns_set = connection_set_;
- service_->post([=]
+ service_->post([conns_set]
{
- auto connections = *connection_set_;
+ auto connections = *conns_set;
for (auto& connection : connections)
- connection->stop();
+ connection->stop();
});
}
// To keep the io_service::run() running although no pending async
// operations are posted.
auto work = std::make_shared<boost::asio::io_service::work>(*service);
- auto thread = std::make_shared<boost::thread>([service]
+ auto weak_work = std::weak_ptr<boost::asio::io_service::work>(work);
+ auto thread = std::make_shared<boost::thread>([service, weak_work]
{
ensure_gpf_handler_installed_for_thread("asio-thread");
- service->run();
+ while (weak_work.lock())
+ {
+ try
+ {
+ service->run();
+ }
+ catch (...)
+ {
+ CASPAR_LOG_CURRENT_EXCEPTION();
+ }
+ }
});
return std::shared_ptr<boost::asio::io_service>(
{
initial_media_info_thread_ = boost::thread([this]
{
- ensure_gpf_handler_installed_for_thread("initial media scan");
-
- for (boost::filesystem::wrecursive_directory_iterator iter(env::media_folder()), end; iter != end; ++iter)
+ try
{
- if (running_)
- {
- if (boost::filesystem::is_regular_file(iter->path()))
- media_info_repo_->get(iter->path().wstring());
- }
- else
+ ensure_gpf_handler_installed_for_thread("initial media scan");
+
+ for (boost::filesystem::wrecursive_directory_iterator iter(env::media_folder()), end; iter != end; ++iter)
{
- CASPAR_LOG(info) << L"Initial media information retrieval aborted.";
- return;
+ if (running_)
+ {
+ if (boost::filesystem::is_regular_file(iter->path()))
+ media_info_repo_->get(iter->path().wstring());
+ }
+ else
+ {
+ CASPAR_LOG(info) << L"Initial media information retrieval aborted.";
+ return;
+ }
}
- }
- CASPAR_LOG(info) << L"Initial media information retrieval finished.";
+ CASPAR_LOG(info) << L"Initial media information retrieval finished.";
+ }
+ catch (...)
+ {
+ CASPAR_LOG_CURRENT_EXCEPTION();
+ }
});
}
};