nux-1.16.0
nux::SystemThread Class Reference
Inheritance diagram for nux::SystemThread:
nux::AbstractThread nux::NThread

List of all members.

Public Member Functions

 SystemThread (AbstractThread *Parent=0)
virtual ThreadState Start (void *arg)

Protected Member Functions

virtual unsigned int Run (void *arg)
virtual ThreadState StartChildThread (NThread *thread, bool Modal)
virtual void AddChildThread (NThread *)
virtual void RemoveChildThread (NThread *)
virtual void ChildHasFinished (NThread *app)
virtual void TerminateAllChildThread ()
virtual bool ThreadCtor ()
virtual bool ThreadDtor ()

Protected Attributes

void * m_InitData
void * m_ExitData

Friends

class WindowThread
SystemThreadCreateSystemThread (AbstractThread *Parent, ThreadUserInitFunc UserInitFunc, void *InitData)

Detailed Description

Definition at line 32 of file SystemThread.h.


Member Function Documentation

t_u32 nux::SystemThread::Run ( void *  ) [protected, virtual]

Info: Override this method.

This function should contain the body/code of your thread. Notice the signature is similar to that of any worker thread function except for the calling convention.

Implements nux::AbstractThread.

Definition at line 74 of file SystemThread.cpp.

References m_InitData.

  {
    if (m_UserInitFunc)
    {
      (*m_UserInitFunc) (this, m_InitData);
    }

    if (m_Parent)
    {
      if (m_Parent->Type().IsObjectType (SystemThread::StaticObjectType) )
        static_cast<SystemThread *> (m_Parent)->ChildHasFinished (this);

      if (m_Parent->Type().IsObjectType (WindowThread::StaticObjectType) )
        static_cast<WindowThread *> (m_Parent)->ChildHasFinished (this);
    }

    SetThreadState (THREADSTOP);
    TerminateAllChildThread();
    return 0;
  }
ThreadState nux::SystemThread::Start ( void *  arg) [virtual]

Info: Starts the thread.

This function starts the thread pointed by m_pThreadFunc with default attributes

Reimplemented from nux::NThread.

Definition at line 55 of file SystemThread.cpp.

  {
    if (!m_Parent)
    {
      return NThread::Start();
    }
    else
    {
      if (m_Parent->Type().IsObjectType (SystemThread::StaticObjectType) )
        return static_cast<SystemThread *> (m_Parent)->StartChildThread (this, true);

      if (m_Parent->Type().IsObjectType (WindowThread::StaticObjectType) )
        return static_cast<WindowThread *> (m_Parent)->StartChildThread (this, true);

      nuxAssertMsg (0, TEXT ("[WindowThread::Start] This should not happen.") );
      return THREAD_START_ERROR;
    }
  }
bool nux::SystemThread::ThreadCtor ( ) [protected, virtual]

Info: Constructor-like function.

Will be called by EntryPoint before executing the thread body. Override this function to provide your extra initialization.

NOTE: do not confuse it with the classes constructor

Reimplemented from nux::NThread.

Definition at line 151 of file SystemThread.cpp.

  {
    SetThreadState (THREADRUNNING);

    return true;
  }
bool nux::SystemThread::ThreadDtor ( ) [protected, virtual]

Info: Destructor-like function.

Will be called by EntryPoint after executing the thread body. Override this function to provide your extra destruction.

NOTE: do not confuse it with the classes constructor

Reimplemented from nux::NThread.

Definition at line 158 of file SystemThread.cpp.

  {
    return true;
  }

Member Data Documentation

void* nux::SystemThread::m_InitData [protected]

This pointer maybe set by the user in ThreadInitFunc and reused in ThreadExitFunc

Reimplemented from nux::AbstractThread.

Definition at line 58 of file SystemThread.h.

Referenced by Run().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends