CatapultServer  v0.5.0.1 (Elephant)
ToolThreadUtils.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include "catapult/utils/Logging.h"
24 
25 namespace catapult { namespace thread { class IoThreadPool; } }
26 
27 namespace catapult { namespace tools {
28 
31  template<typename TAction, typename TFuture>
32  bool UnwrapFutureAndSuppressErrors(const char* description, TFuture&& future, TAction action) {
33  try {
34  action(future.get());
35  return true;
36  } catch (...) {
37  // suppress
39  return false;
40  }
41  }
42 
44  std::shared_ptr<thread::IoThreadPool> CreateStartedThreadPool(uint32_t numThreads = 1);
45 }}
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
colorPrint.warning
def warning(*args)
Definition: colorPrint.py:10
ToolThreadUtils.h
ExceptionLogging.h
catapult::thread::CreateIoThreadPool
std::unique_ptr< IoThreadPool > CreateIoThreadPool(size_t numWorkerThreads, const char *name)
Definition: IoThreadPool.cpp:146
IoThreadPool.h
catapult::tools::UnwrapFutureAndSuppressErrors
bool UnwrapFutureAndSuppressErrors(const char *description, TFuture &&future, TAction action)
Definition: ToolThreadUtils.h:32
catapult::action
std::function< void()> action
An action function.
Definition: functions.h:27
catapult::tools::CreateStartedThreadPool
std::shared_ptr< thread::IoThreadPool > CreateStartedThreadPool(uint32_t numThreads)
Creates a started thread pool with numThreads threads.
Definition: ToolThreadUtils.cpp:26
UNHANDLED_EXCEPTION_MESSAGE
#define UNHANDLED_EXCEPTION_MESSAGE(ACTION)
Outputs a message for an unhandled exception that occurred during ACTION.
Definition: ExceptionLogging.h:30
catapult
Definition: AddressExtractionExtension.cpp:28
Logging.h