ZNC  trunk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
CModuleJob Class Referenceabstract

A CJob version which can be safely used in modules. More...

#include <Modules.h>

+ Inheritance diagram for CModuleJob:
+ Collaboration diagram for CModuleJob:

Public Types

enum  EJobState { READY, RUNNING, DONE, CANCELLED }
 

Public Member Functions

 CModuleJob (CModule *pModule, const CString &sName, const CString &sDesc)
 
virtual ~CModuleJob ()
 
 CModuleJob (const CModuleJob &)=delete
 
CModuleJoboperator= (const CModuleJob &)=delete
 
CModuleGetModule () const
 
const CStringGetName () const
 
const CStringGetDescription () const
 
virtual void runThread ()=0
 This function is called in a separate thread and can do heavy, blocking work. More...
 
virtual void runMain ()=0
 This function is called from the main thread after runThread() finishes. More...
 
bool wasCancelled () const
 This can be used to check if the job was cancelled. More...
 

Protected Attributes

CModulem_pModule
 
const CString m_sName
 
const CString m_sDescription
 

Detailed Description

A CJob version which can be safely used in modules.

The job will be cancelled when the module is unloaded.

Member Enumeration Documentation

enum CJob::EJobState
inherited
Enumerator
READY 
RUNNING 
DONE 
CANCELLED 

Constructor & Destructor Documentation

CModuleJob::CModuleJob ( CModule pModule,
const CString sName,
const CString sDesc 
)
inline
virtual CModuleJob::~CModuleJob ( )
virtual
CModuleJob::CModuleJob ( const CModuleJob )
delete

Member Function Documentation

const CString& CModuleJob::GetDescription ( ) const
inline

References m_sDescription.

CModule* CModuleJob::GetModule ( ) const
inline

References m_pModule.

const CString& CModuleJob::GetName ( ) const
inline

References m_sName.

CModuleJob& CModuleJob::operator= ( const CModuleJob )
delete
virtual void CJob::runMain ( )
pure virtualinherited

This function is called from the main thread after runThread() finishes.

It can be used to handle the results from runThread() without needing synchronization primitives.

virtual void CJob::runThread ( )
pure virtualinherited

This function is called in a separate thread and can do heavy, blocking work.

bool CJob::wasCancelled ( ) const
inherited

This can be used to check if the job was cancelled.

For example, runThread() can return early if this returns true.

Member Data Documentation

CModule* CModuleJob::m_pModule
protected

Referenced by GetModule().

const CString CModuleJob::m_sDescription
protected

Referenced by GetDescription().

const CString CModuleJob::m_sName
protected

Referenced by GetName().


The documentation for this class was generated from the following file: