ThreadedUIUpdateRef< T > Class Template Reference

#include <threaded_update_helper.h>

Detailed Description

template<typename T>
class maxon::ThreadedUIUpdateRef< T >

Helper class to create threaded UI updates with a single call.

struct TexGuiThreadUpdate : public maxon::ThreadedUIUpdate<TexGuiThreadUpdate>
{
};
_texGuiThreadedPtr.Start(
[](TexGuiThreadUpdate* self) -> maxon::Result<void>
{
// worker thread, non-UI thread!!!
//...
return OK;
},
maxon::Milliseconds(100.0), false,
[this](TexGuiThreadUpdate* self) -> maxon::Result<void>
{
// first delay, UI thread!!!
return maxon::OK;
},
[this](TexGuiThreadUpdate* self) -> void
{
// progress timer, UI thread!!!
},
[this](TexGuiThreadUpdate* self, maxon::Error threadError) -> maxon::Result<void>
{
// progress timer, UI thread!!!
if (threadError)
{
}
else
{
}
return maxon::OK;
}
Template Parameters
Ttype that needs to be declared like: struct TexGuiThreadUpdate : public maxon::ThreadedUIUpdate<TexGuiThreadUpdate> {};

Public Member Functions

Result< void > Start (Delegate< Result< void >(T *self)> &&threadFn, const TimeValue &timerDelay, Bool waitFirstDelay, Delegate< Result< void >(T *self)> &&startWaitFn, const TimeValue &timerInterval, Delegate< void(T *self)> &&timerWaitFn, Delegate< Result< void >(T *self, Error threadError)> &&finalUpdateFunc)
 
void Free ()
 
StrongRef< T > GetRef ()
 

Private Attributes

StrongRef< T > _ref
 

Member Function Documentation

◆ Start()

Result<void> Start ( Delegate< Result< void >(T *self)> &&  threadFn,
const TimeValue timerDelay,
Bool  waitFirstDelay,
Delegate< Result< void >(T *self)> &&  startWaitFn,
const TimeValue timerInterval,
Delegate< void(T *self)> &&  timerWaitFn,
Delegate< Result< void >(T *self, Error threadError)> &&  finalUpdateFunc 
)

◆ Free()

void Free ( )

◆ GetRef()

StrongRef<T> GetRef ( )

Member Data Documentation

◆ _ref

StrongRef<T> _ref
private
maxon::ThreadedUIUpdate
Definition: threaded_update_helper.h:26
maxon::OK
return OK
Definition: apibase.h:2532
iferr_return
#define iferr_return
Definition: resultbase.h:1434
maxon::Result< void >
iferr_scope
#define iferr_scope
Definition: resultbase.h:1343
maxon::ThreadedUIUpdateRef::Start
Result< void > Start(Delegate< Result< void >(T *self)> &&threadFn, const TimeValue &timerDelay, Bool waitFirstDelay, Delegate< Result< void >(T *self)> &&startWaitFn, const TimeValue &timerInterval, Delegate< void(T *self)> &&timerWaitFn, Delegate< Result< void >(T *self, Error threadError)> &&finalUpdateFunc)
Definition: threaded_update_helper.h:118
maxon::Milliseconds
Timer value in milliseconds.
Definition: timevalue.h:436
maxon::ThreadedUIUpdateRef
Definition: threaded_update_helper.h:114