20#ifndef INCLUDED_VCL_THREADEX_HXX
21#define INCLUDED_VCL_THREADEX_HXX
23#include <osl/conditn.hxx>
49namespace solarthread {
54template <
typename FuncT,
typename ResultT>
58 static ResultT
exec( FuncT
const& func )
61 ::std::unique_ptr<ExecutorT>
const pExecutor(
new ExecutorT(func) );
64 std::rethrow_exception(pExecutor->m_exc);
65 return *pExecutor->m_result;
72 virtual void doIt()
override
78 m_exc = std::current_exception();
93template <
typename FuncT>
97 static void exec( FuncT
const& func )
100 ::std::unique_ptr<ExecutorT>
const pExecutor(
new ExecutorT(func) );
101 pExecutor->execute();
102 if (pExecutor->m_exc)
103 std::rethrow_exception(pExecutor->m_exc);
116 m_exc = std::current_exception();
163template <
typename FuncT>
167 FuncT,
decltype(func())>::exec(func);
DECL_DLLPRIVATE_LINK(worker, void *, void)
static void exec(FuncT const &func)
virtual void doIt() override
GenericSolarThreadExecutor(FuncT func)
static ResultT exec(FuncT const &func)
virtual void doIt() override
::std::optional< ResultT > m_result
GenericSolarThreadExecutor(FuncT func)
auto syncExecute(FuncT const &func) -> decltype(func())
This function will execute the passed functor synchronously in the solar thread, thus the calling thr...