#include <UObjDeletionThread.h>
Public Member Functions | |
int | id () const |
void | setObj (T *obj) |
void | startDeletion (int waitMs=0) |
UObjDeletionThread (T *obj, int id=0) | |
virtual | ~UObjDeletionThread () |
![]() | |
Handle | getThreadHandle () const |
unsigned long | getThreadId () const |
bool | isCreating () const |
bool | isIdle () const |
bool | isKilled () const |
bool | isRunning () const |
void | join (bool killFirst=false) |
void | kill () |
void | setAffinity (int cpu=0) |
void | setPriority (Priority priority) |
void | start () |
UThread (Priority priority=kPNormal) | |
virtual | ~UThread () |
![]() | |
int | Create (Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const |
int | Create (Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const |
int | Create (unsigned long &ThreadId, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const |
int | Create (unsigned long &ThreadId, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const |
virtual | ~UThreadC () |
virtual | ~UThreadC () |
Private Member Functions | |
virtual void | mainLoop () |
Private Attributes | |
int | id_ |
T * | obj_ |
int | waitMs_ |
Additional Inherited Members | |
![]() | |
enum | Priority { kPLow, kPBelowNormal, kPNormal, kPAboveNormal, kPRealTime } |
![]() | |
typedef THREAD_HANDLE | Handle |
typedef THREAD_HANDLE | Handle |
typedef void(* | Handler) () |
typedef void(* | Handler) () |
![]() | |
static unsigned long | currentThreadId () |
![]() | |
static int | Create (const Handler &Function, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) |
static int | Create (const Handler &Function, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) |
static int | Detach (const Handle &H) |
static int | Detach (Handle H) |
static int | Join (const Handle &H) |
static int | Join (Handle H) |
static int | Kill (const Handle &H) |
static int | Kill (Handle H) |
![]() | |
UThreadC () | |
UThreadC () | |
![]() | |
static void | Exit () |
static void | Exit () |
static Handle | Self () |
static int | Self () |
static void | TestCancel () |
static void | TestCancel () |
This class can be used to delete a dynamically created object in another thread. Give the dynamic reference to object to it and it will notify with a UObjDeletedEvent when the object is deleted. The deletion can be delayed on startDeletion(), the thread will wait the time given before deleting the object.
Definition at line 48 of file UObjDeletionThread.h.
|
inline |
The constructor.
obj | the object to delete |
id | the custom id which will be sent in a event UObjDeletedEvent after the object is deleted |
Definition at line 56 of file UObjDeletionThread.h.
|
inlinevirtual |
The destructor. If this thread is not started but with an object set, the object is deleted. If the thread has not finished to delete the object, the calling thread will wait (on a UThreadNode::join()) until the object is deleted.
obj | the object to delete |
id | the custom id which will be sent in a event UObjDeletedEvent after the object is deleted |
Definition at line 68 of file UObjDeletionThread.h.
|
inline |
|
inlineprivatevirtual |
|
inline |
Set a new object, if one was already set, the old one is deleted.
obj | the object to delete |
Definition at line 93 of file UObjDeletionThread.h.
|
inline |
Start the thread after optional delay.
waitMs | the delay before deletion |
Definition at line 81 of file UObjDeletionThread.h.
|
private |
Definition at line 125 of file UObjDeletionThread.h.
|
private |
Definition at line 124 of file UObjDeletionThread.h.
|
private |
Definition at line 126 of file UObjDeletionThread.h.