8 #include <FMEThirdPartyWarningsDisable.h>
11 #include <FMEThirdPartyWarningsRestore.h>
14 #include <FMEThirdPartyWarningsDisable.h>
17 #include <FMEThirdPartyWarningsRestore.h>
27 template <
typename Callable>
30 auto* message =
NewBackgroundTaskMethodCall(
this, &UnprotectedMainThreadCommunicator::execute<Callable>, std::forward<Callable>(callable));
31 auto& mgr = BackgroundTaskManager::self();
32 mgr.sendMessageToGUI(message);
35 template<
typename Callable>
36 void call(Callable&& callable)
38 if (BackgroundTaskManager::ensureGUIThread()) {
39 std::forward<Callable>(callable)();
42 callLater(std::forward<Callable>(callable));
46 template<
typename Object,
typename Method,
typename... Args>
47 void call(Object*
object, Method method,
const Args&... args)
49 call([
object, method, args...] {
50 (object->*method)(args...);
56 template<
typename Callable>
57 void execute(
const Callable& callable)
70 Access(std::mutex& mutex, std::weak_ptr<UnprotectedMainThreadCommunicator> implementation);
72 operator bool()
const;
80 std::unique_lock<std::mutex> lock;
81 std::shared_ptr<UnprotectedMainThreadCommunicator> implementation;
88 Handle(std::shared_ptr<std::mutex> mutex,
const std::shared_ptr<UnprotectedMainThreadCommunicator>& implementation);
94 std::shared_ptr<std::mutex> mutex;
95 std::weak_ptr<UnprotectedMainThreadCommunicator> implementation;
111 std::shared_ptr<std::mutex> mutex;
112 std::shared_ptr<UnprotectedMainThreadCommunicator> implementation;
#define MLMAINTHREADCOMMUNICATOR_EXPORT
The background task receiver is a light-weight base class that can be inherited (e....
~MainThreadCommunicator()
void callLater(Callable &&callable)
void call(Object *object, Method method, const Args &... args)
void call(Callable &&callable)
static void call(MLDataType dataType, Processor &processor)
Call the process<DataType>() method on the given processor, where the DataType type is dynamically se...
BackgroundTaskMessage * NewBackgroundTaskMethodCall(Object *object, Method method)
Creates a new method call with zero arguments.
T operator*(const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b)
Dot product, returns a.dot(b).