6 #ifndef __FWCOM_SLOTRUN_HXX__ 7 #define __FWCOM_SLOTRUN_HXX__ 9 #ifndef __FWCOM_SLOTRUN_HPP__ 10 #error fwCom/SlotRun.hpp not included 13 #include "fwCom/exception/NoWorker.hpp" 14 #include "fwCom/SlotBase.hxx" 15 #include "fwCom/util/WeakCall.hpp" 17 #include <fwCore/mt/types.hpp> 19 #include <fwThread/TaskHandler.hpp> 20 #include <fwThread/Worker.hpp> 29 template<
typename ... A >
30 inline std::function< void() >
SlotRun< void (A ...) >::bindRun( A ... args )
const 32 return std::bind( (
void (
SelfType::*)( A ... )
const ) &SelfType::run,
this, args ... );
37 template<
typename ... A >
39 const ::fwThread::Worker::sptr& worker, A ... args )
const 46 return postWeakCall< void >(
48 ::fwCom::util::weakcall(
49 std::dynamic_pointer_cast< const SlotBase >(this->shared_from_this()),
50 this->bindRun( args ... )
57 template<
typename ... A >
67 return postWeakCall< void >(
69 ::fwCom::util::weakcall(
70 std::dynamic_pointer_cast< const SlotBase >(this->shared_from_this()),
71 this->bindRun( args ... ),
81 template<
typename ... A >
82 template<
typename R,
typename WEAKCALL >
83 std::shared_future< R >
SlotRun< void (A ...) >::postWeakCall( const ::fwThread::Worker::sptr& worker, WEAKCALL f )
85 std::packaged_task< R() > task( f );
86 std::future< R > ufuture = task.get_future();
88 std::function< void() > ftask = ::fwThread::moveTaskIntoFunction(task);
92 return std::move(ufuture);
Namespace containing fw4spl communication tools.
::boost::shared_lock< ReadWriteMutex > ReadLock
Defines a lock of read type for read/write mutex.
std::shared_future< void > VoidSharedFutureType
SlotBase::asyncRun return type.