Reference to a group (JobGroupInterface).
|
| MAXON_DEFAULT_REFERENCE_CONSTRUCTORS (JobGroupRef, Ptr) |
|
JobGroupRef & | Enqueue (JobQueueInterface *queue=JOBQUEUE_CURRENT) |
|
Result< void > | EnqueueAndWait (JobQueueInterface *queue=JOBQUEUE_CURRENT) |
|
Bool | Wait (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const |
|
Result< void > | GetResult (TimeValue timeout=TIMEVALUE_INFINITE, WAITMODE mode=WAITMODE::DEFAULT) const |
|
template<typename T > |
Result< void > | Add (T &&obj) |
|
template<JOBCANCELLATION B, typename T > |
Result< void > | Add (T &&obj) |
|
ObservableFinishedBase< JobGroupInterface > | ObservableFinished () |
|
void | Cancel () |
|
void | CancelAndWait (WAITMODE mode=WAITMODE::DEFAULT) |
|
String | ToString (const FormatStatement *formatStatement=nullptr) const |
|
T * | GetPointer () |
|
ConstReferencedType * | GetPointer () const |
|
T * | operator-> () |
|
ConstReferencedType * | operator-> () const |
|
std::conditional< std::is_void< T >::value, DeleteReturnType01, T >::type & | operator* () |
|
std::conditional< std::is_void< ConstReferencedType >::value, DeleteReturnType01, T >::type & | operator* () const |
|
| operator T* () |
|
| operator ConstReferencedType * () const |
|
| operator Bool () const |
|
| operator Bool () |
|
const std::conditional< std::is_void< T >::value, DeleteReturnType01, T >::type & | operator[] (Int) const =delete |
|
ResultRef< typename std::remove_const< T >::type > | MakeWritable (Bool resetOnError=true) |
|
std::conditional< std::is_void< T >::value, DeleteReturnType01, T >::type & | GetOrNull () 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) |
|
BaseRef & | operator= (T *src) |
|
BaseRef & | operator= (std::nullptr_t src) |
|
BaseRef & | operator= (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> |
BaseRef & | operator= (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> |
BaseRef & | operator= (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) |
|
BaseRef & | operator= (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> |
BaseRef & | operator= (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 |
|
T * | Disconnect () |
|
void | PrivateSetTarget (ResultPtr< T > src) |
|
void | PrivateSetPointer (T *ptr) |
|
Waits until all jobs of the group have been executed.
Wait() might execute other jobs in the current queue until the group you are waiting for has finished or is timed out. Therefore you may never lock a shared resource another job might use as well and then wait. For one this could dead-lock and conceptually this would result in single-threaded performance.
If you try to call Wait() from a job which did not enqueue the group it will immediately return false because this would lead to a deadlock.
Instead of waiting for some group to start some action after it has finished you can subscribe to ObservableFinished(). This cannot dead-lock, is more efficient and can even be used to run the observer in a different queue. For example you can run a job and register an observer for it that will run on the main thread's queue and updates the UI. THREADSAFE.
- Parameters
-
[in] | timeout | Maximum wait interval (or TIMEVALUE_INFINITE for no time-out). |
[in] | mode | WAITMODE::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
- True if successful, false if you try to wait inside an enqueued job.
Adds a job, a lambda, a BaseArray of jobs or a whole subgroup. The group takes exclusive ownership of whatever is added.
If you add a job it will be deleted after it has been executed, when the group will be deleted or when adding the job fails. The job must have been created using the DefaultAllocator, e.g. with Create() or NewObj(). If you had created a job on the stack or used a custom allocator this would lead to a crash.
If you add a BaseArray with multiple jobs of the same type to the group (this is faster than single Add()s) the jobs and the memory for the array will be freed after they have been executed. If adding the jobs failed they and the memory will be deleted automatically. The array must use the DefaultAllocator for memory allocations. Do not use a custom allocator because this would lead to a crash.
If you add a subgroup this will add a reference to the group and remove it when the group is not accessed anymore. If adding a subgroup fails its reference will be removed and its jobs will be stopped.
As long as the group is not enqueued you can add jobs from any thread. As soon as it is enqueued only jobs belonging to the group are allowed to add further jobs. THREADSAFE.
- Parameters
-
[in] | obj | A job, lambda, BaseArray of jobs or a subgroup. |
- Returns
- OK on success.