ThreadResultRef< RESULTVALUETYPE > Class Template Reference

#include <thread.h>

Inheritance diagram for ThreadResultRef< RESULTVALUETYPE >:

Detailed Description

template<typename RESULTVALUETYPE>
class maxon::ThreadResultRef< RESULTVALUETYPE >

Reference to a thread that returns more than void/Result<void>.

Public Member Functions

 ThreadResultRef (const ThreadRef &src)
 
 ThreadResultRef (ThreadRef &&src)
 
Result< RESULTVALUETYPE > GetResult (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const
 
- Public Member Functions inherited from ThreadRefTemplate< ThreadInterface >
 MAXON_DEFAULT_REFERENCE_CONSTRUCTORS (ThreadRefTemplate, Ptr)
 
MAXON_IMPLICIT ThreadRefTemplate (const Ptr &src)
 
MAXON_IMPLICIT ThreadRefTemplate (Ptr &&src)
 
Bool IsRunning () const
 
Bool Wait (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const
 
Result< void > GetResult (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const
 
void Cancel ()
 
Bool IsCancelled () const
 
void CancelAndWait (WAITMODE mode=WAITMODE::DEFAULT)
 
Result< void > Start (THREADPRIORITY priority=THREADPRIORITY::NORMAL)
 
ObservableFinishedBase< ThreadInterfaceObservableFinished ()
 
String ToString (const FormatStatement *formatStatement=nullptr) const
 
Bool operator== (const ThreadRefTemplate &other) const
 
Bool operator!= (const ThreadRefTemplate &other) const
 
- Public Member Functions inherited from BaseRef< T, HANDLER >
T * GetPointer ()
 
ConstReferencedTypeGetPointer () const
 
T * operator-> ()
 
ConstReferencedTypeoperator-> () const
 
std::conditional< std::is_void< T >::value, DeleteReturnType01, T >::typeoperator* ()
 
std::conditional< std::is_void< ConstReferencedType >::value, DeleteReturnType01, T >::typeoperator* () const
 
 operator T* ()
 
 operator ConstReferencedType * () const
 
 operator Bool () const
 
 operator Bool ()
 
const std::conditional< std::is_void< T >::value, DeleteReturnType01, T >::typeoperator[] (Int) const =delete
 
ResultRef< typename std::remove_const< T >::typeMakeWritable (Bool resetOnError=true)
 
ResultRef< typename std::remove_const< T >::typeMakeWritableDontCopy ()
 
Bool HasMultipleReferences () const
 
std::conditional< std::is_void< T >::value, DeleteReturnType01, T >::typeGetOrNull () const
 
 BaseRef ()
 
MAXON_IMPLICIT BaseRef (std::nullptr_t)=delete
 
MAXON_IMPLICIT BaseRef (T *o)
 
template<typename PTR >
 BaseRef (ForwardResultPtr< PTR > o)
 
 BaseRef (ResultPtr< T > o, Int)
 
 BaseRef (const BaseRef &src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
MAXON_IMPLICIT BaseRef (const REF &src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
MAXON_IMPLICIT BaseRef (REF &src)
 
BaseRefoperator= (T *src)
 
BaseRefoperator= (std::nullptr_t src)
 
BaseRefoperator= (const BaseRef &src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
BaseRefoperator= (const REF &src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
BaseRefoperator= (REF &src)
 
 BaseRef (BaseRef &&src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(const, REF) && !STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
MAXON_IMPLICIT BaseRef (REF &&src)
 
BaseRefoperator= (BaseRef &&src)
 
template<typename REF , typename = typename std::enable_if<!STD_IS_REPLACEMENT(const, REF) && !STD_IS_REPLACEMENT(base_of, BaseRef, REF) && maxon::HasErasedBase<typename REF::ReferencedType, ReferencedType>::value>::type>
BaseRefoperator= (REF &&src)
 
 ~BaseRef ()
 
Bool operator== (const BaseRef &b) const
 
Bool operator!= (const BaseRef &b) const
 
Bool operator< (const BaseRef &b) const
 
 MAXON_OPERATOR_INEQUALITY (BaseRef)
 
Bool operator== (const T *b) const
 
Bool operator!= (const T *b) const
 
Bool operator== (typename std::remove_const< T >::type *b) const
 
Bool operator!= (typename std::remove_const< T >::type *b) const
 
Bool operator== (std::nullptr_t) const
 
Bool operator!= (std::nullptr_t) const
 
HashInt GetHashCode () const
 
UniqueHash GetUniqueHashCode () const
 
std::conditional< Bool(HANDLER::KIND &VALUEKIND::COW_MASK), typename std::remove_const< T >::type, T >::typeDisconnect ()
 
void PrivateSetTarget (ResultPtr< T > src)
 
void PrivateSetPointer (T *ptr)
 

Additional Inherited Members

- Public Types inherited from BaseRef< T, HANDLER >
using ReferencedType = T
 
using ConstReferencedType = typename ConstIf< T, Bool(HANDLER::KIND &VALUEKIND::DEEP_CONSTNESS)>::type
 
using DirectlyReferencedType = T
 
using SelfType = BaseRef< T, HANDLER >
 
template<typename D >
using IsGenericBaseOf = std::true_type
 
using Handler = HANDLER
 
using RefCompareType = RefCompare< MAXON_IS_COW_KIND(HANDLER::KIND), IsInterfaceType< T >::value >
 
- Static Public Member Functions inherited from ThreadRefTemplate< ThreadInterface >
static auto Create (FN &&src, ARGS &&... args) -> ResultMemT< ThreadResultRef< decltype(src(std::forward< ARGS >(args)...))>>
 
static StrongRef< const ThreadInterfaceGetCurrentThread ()
 
static Int GetCurrentThreadCount ()
 
static Bool IsMainThread ()
 
static THREADTYPE GetCurrentThreadType ()
 
static THREADTYPE GetCurrentThreadType (Int &threadIdentifier)
 
static Result< void > AssimilateAlienThread ()
 
static Bool IsCurrentThreadCancelled (const ThreadInterface *optionalThread=nullptr)
 
static Bool IsCurrentThreadCancelled (const ThreadRefTemplate< ThreadInterface > &optionalThread)
 
static MAXON_WARN_UNUSED auto Run (FN &&src, THREADPRIORITY priority=THREADPRIORITY::NORMAL) -> ResultMemT< ThreadResultRef< decltype(src())>>
 
static auto Run (FN &&src, THREADPRIORITY priority, ARGS &&... args) -> ResultMemT< ThreadResultRef< decltype(src(std::forward< ARGS >(args)...))>>
 
static MAXON_ATTRIBUTE_FORCE_INLINE const ThreadRefTemplateNullValue ()
 
- Static Public Member Functions inherited from BaseRef< T, HANDLER >
static void PrivateLookupFn ()
 
static std::false_type GenericVarianceCheck (const void *)
 
template<typename... ARGS>
static MAXON_ATTRIBUTE_FORCE_INLINE ResultMemT< BaseRefCreate (ARGS &&... args)
 
static const BaseRefNullValueRef ()
 
static std::conditional< Bool(HANDLER::KIND &VALUEKIND::UNIQUE_REFERENCE), BaseRef, const BaseRef & >::type NullValue ()
 
- Static Public Attributes inherited from BaseRef< T, HANDLER >
static constexpr Bool DIRECT_REF
 
- Protected Attributes inherited from BaseRef< T, HANDLER >
union {
   T *   _object
 
   const void *   _impl
 
}; 
 

Constructor & Destructor Documentation

◆ ThreadResultRef() [1/2]

ThreadResultRef ( const ThreadRef src)
explicit

◆ ThreadResultRef() [2/2]

ThreadResultRef ( ThreadRef &&  src)
explicit

Member Function Documentation

◆ GetResult()

Result<RESULTVALUETYPE> GetResult ( TimeValue  timeout = TIMEVALUE_INFINITE,
WAITMODE  mode = WAITMODE::DEFAULT 
) const

Waits until this thread has been executed and returns the result. THREADSAFE.

Parameters
[in]timeoutMaximum wait interval (or TIMEVALUE_INFINITE for no time-out).
[in]modeWAITMODE::DEFAULT by default. WAITMODE::RETURN_ON_CANCEL means that Wait() will return if the caller has been cancelled even if the condition has not been set yet.
Returns
OK on success.