Anope IRC Services  Version 2.0
Public Member Functions | Data Fields | Private Attributes
Thread Class Referenceabstract

#include <threadengine.h>

Inheritance diagram for Thread:
Inheritance graph
[legend]
Collaboration diagram for Thread:
Collaboration graph
[legend]

Public Member Functions

 Thread ()
 
virtual ~Thread ()
 
void Join ()
 
void SetExitState ()
 
void Exit ()
 
void Start ()
 
bool GetExitState () const
 
void OnNotify ()
 
virtual void Run ()=0
 
- Public Member Functions inherited from Pipe
 Pipe ()
 
 ~Pipe ()
 
bool ProcessRead () anope_override
 
void Write (const char *data, size_t sz)
 
void Write (const Anope::string &data)
 
int Read (char *data, size_t sz)
 
bool SetWriteBlocking (bool state)
 
void Notify ()
 
- Public Member Functions inherited from Socket
 Socket ()
 
 Socket (int sock, bool ipv6=false, int type=SOCK_STREAM)
 
virtual ~Socket ()
 
int GetFD () const
 
bool IsIPv6 () const
 
bool SetBlocking (bool state)
 
void Bind (const Anope::string &ip, int port=0)
 
virtual bool Process ()
 
virtual bool ProcessWrite ()
 
virtual void ProcessError ()
 
- Public Member Functions inherited from Extensible
virtual ~Extensible ()
 
template<typename T >
T * GetExt (const Anope::string &name) const
 
bool HasExt (const Anope::string &name) const
 
template<typename T >
T * Extend (const Anope::string &name, const T &what)
 
template<typename T >
T * Extend (const Anope::string &name)
 
template<typename T >
T * Require (const Anope::string &name)
 
template<typename T >
void Shrink (const Anope::string &name)
 
template<>
bool * Extend (const Anope::string &name, const bool &what)
 

Data Fields

pthread_t handle
 
- Data Fields inherited from Pipe
int write_pipe
 
- Data Fields inherited from Socket
std::bitset< SF_SIZEflags
 
sockaddrs bindaddr
 
SocketIOio
 
- Data Fields inherited from Extensible
std::set< ExtensibleBase * > extension_items
 

Private Attributes

bool exit
 

Additional Inherited Members

- Static Public Member Functions inherited from Extensible
static void ExtensibleSerialize (const Extensible *, const Serializable *, Serialize::Data &data)
 
static void ExtensibleUnserialize (Extensible *, Serializable *, Serialize::Data &data)
 
- Protected Attributes inherited from Socket
int sock
 
bool ipv6
 

Detailed Description

Definition at line 19 of file threadengine.h.

Constructor & Destructor Documentation

Thread::Thread ( )

Threads constructor

Definition at line 48 of file threadengine.cpp.

Thread::~Thread ( )
virtual

Threads destructor

Definition at line 52 of file threadengine.cpp.

Member Function Documentation

void Thread::Exit ( )

Exit the thread. Note that the thread still must be joined to free resources!

Definition at line 68 of file threadengine.cpp.

References pthread_exit(), and SetExitState().

bool Thread::GetExitState ( ) const

Returns the exit state of the thread

Returns
true if we want to exit

Definition at line 83 of file threadengine.cpp.

References exit.

Referenced by DispatcherThread::Run(), and LDAPService::Run().

void Thread::Join ( )

Join to the thread, sets the exit state to true

Definition at line 56 of file threadengine.cpp.

References handle, pthread_join(), and SetExitState().

Referenced by OnNotify(), and ModuleSQL::~ModuleSQL().

void Thread::OnNotify ( )
virtual

Called when this thread should be joined to

Implements Pipe.

Definition at line 88 of file threadengine.cpp.

References Socket::flags, Join(), and SF_DEAD.

virtual void Thread::Run ( )
pure virtual

Called when the thread is run.

Implemented in LDAPService, DispatcherThread, and Mail::Message.

Referenced by entry_point().

void Thread::SetExitState ( )

Sets the exit state as true informing the thread we want it to shut down

Definition at line 62 of file threadengine.cpp.

References exit, and Pipe::Notify().

Referenced by entry_point(), Exit(), Join(), ModuleLDAP::OnReload(), and ModuleSQL::~ModuleSQL().

void Thread::Start ( )

Field Documentation

bool Thread::exit
private

Definition at line 23 of file threadengine.h.

Referenced by GetExitState(), and SetExitState().

pthread_t Thread::handle

Definition at line 27 of file threadengine.h.

Referenced by Join(), and Start().


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