20#ifndef INCLUDED_VCL_THREADEX_HXX
21#define INCLUDED_VCL_THREADEX_HXX
23#include <osl/conditn.hxx>
50namespace solarthread {
55template <
typename FuncT,
typename ResultT>
59 static ResultT
exec( FuncT
const& func )
62 ::std::unique_ptr<ExecutorT>
const pExecutor(
new ExecutorT(func) );
65 std::rethrow_exception(pExecutor->m_exc);
66 return *pExecutor->m_result;
73 virtual void doIt()
override
79 m_exc = std::current_exception();
94template <
typename FuncT>
98 static void exec( FuncT
const& func )
101 ::std::unique_ptr<ExecutorT>
const pExecutor(
new ExecutorT(func) );
102 pExecutor->execute();
103 if (pExecutor->m_exc)
104 std::rethrow_exception(pExecutor->m_exc);
117 m_exc = std::current_exception();
164template <
typename FuncT>
168 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...