NCBI C++ ToolKit
Public Member Functions | Public Attributes | List of all members
CSrvListener Class Reference

Search Toolkit Book for CSrvListener

+ Inheritance diagram for CSrvListener:
+ Collaboration diagram for CSrvListener:

Public Member Functions

 CSrvListener (void)
 
virtual ~CSrvListener (void)
 
virtual void ExecuteSlice (TSrvThreadNum thread_idx)
 This is the main method to do all work this task should do. More...
 
- Public Member Functions inherited from CSrvTask
 CSrvTask (void)
 
void SetRunnable (bool boost=false)
 Set this task "runnable", i.e. More...
 
void RunAfter (Uint4 delay_sec)
 This call is basically equivalent to SetRunnable() but with guarantee that task will be scheduled for execution no earlier than delay_sec later (approximately, can be up to a second less if measured in absolute wall time). More...
 
virtual void Terminate (void)
 Stops task's execution and deletes it. More...
 
void SetPriority (Uint4 prty)
 Set and retrieve task's priority. More...
 
Uint4 GetPriority (void)
 
void CreateNewDiagCtx (void)
 Create new diagnostic context for this task to work in. More...
 
void SetDiagCtx (CRequestContext *ctx)
 Set diagnostic context for this task to work in. More...
 
CRequestContextGetDiagCtx (void)
 Get current diagnostic context for the task. More...
 
void ReleaseDiagCtx (void)
 Releases current diagnostic context of the task. More...
 
virtual ~CSrvTask (void)
 
virtual void InternalRunSlice (TSrvThreadNum thr_num)
 This is the real time slice execution method called from TaskServer. More...
 

Public Attributes

Uint4 m_SeenEvents [kMaxCntListeningSocks]
 Per-listening-socket numbers copied from s_ListenEvents when events are processed. More...
 
Uint4 m_SeenErrors [kMaxCntListeningSocks]
 Per-listening-socket numbers copied from s_ListenErrors when errors are processed. More...
 
- Public Attributes inherited from CSrvTask
TSrvTaskListHook m_TaskListHook
 Hook to put this task into TSrvTaskList. More...
 
TSrvThreadNum m_LastThread
 Thread number where this task was executed last time. More...
 
TSrvTaskFlags m_TaskFlags
 Bit-OR of flags for this task. More...
 
int m_LastActive
 Time (in seconds) when the task was active last time, i.e. More...
 
Uint4 m_Priority
 Task's priority. More...
 
CRequestContextm_DiagCtx
 Current diagnostic context for this task. More...
 
CRequestContext ** m_DiagChain
 Nested diagnostic contexts of this task. More...
 
size_t m_DiagChainSize
 
STimerTicketm_Timer
 Timer ticket assigned to this task when it calls RunAfter(). More...
 
CSrvTaskTerminator m_Terminator
 Object that will delete this task after call to Terminate(). More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CSrvTask
static void PrintState (CSrvSocketTask &task)
 

Detailed Description

Definition at line 134 of file sockets_man.cpp.

Constructor & Destructor Documentation

◆ CSrvListener()

CSrvListener::CSrvListener ( void  )

Definition at line 1123 of file sockets_man.cpp.

◆ ~CSrvListener()

CSrvListener::~CSrvListener ( void  )
virtual

Definition at line 1130 of file sockets_man.cpp.

Member Function Documentation

◆ ExecuteSlice()

void CSrvListener::ExecuteSlice ( TSrvThreadNum  thr_num)
virtual

This is the main method to do all work this task should do.

This method will be called periodically while somebody calls SetRunnable() or RunAfter() on this task. But number of calls to this method won't match number of calls to SetRunnable() – if several calls to SetRunnable() are made before ExecuteSlice() had a chance to execute it will be called only once. Task's code inside ExecuteSlice() should understand itself how much work it needs to do and call SetRunnable() again if needed (or do all the work before returning from ExecuteSlice()). Parameter thr_num is number of thread on which ExecuteSlice() is called.

Implements CSrvTask.

Definition at line 1134 of file sockets_man.cpp.

References ACCESS_ONCE, SListenSockInfo::fd, i, CTaskServer::IsInShutdown(), m_SeenErrors, m_SeenEvents, s_CloseSocket(), s_CntListeningSocks, s_ListenErrors, s_ListenEvents, s_ListenSocks, s_ProcessListenError(), and s_ProcessListenEvent().

Member Data Documentation

◆ m_SeenErrors

Uint4 CSrvListener::m_SeenErrors[kMaxCntListeningSocks]

Per-listening-socket numbers copied from s_ListenErrors when errors are processed.

Definition at line 148 of file sockets_man.cpp.

Referenced by ExecuteSlice(), and s_ProcessListenError().

◆ m_SeenEvents

Uint4 CSrvListener::m_SeenEvents[kMaxCntListeningSocks]

Per-listening-socket numbers copied from s_ListenEvents when events are processed.

Definition at line 145 of file sockets_man.cpp.

Referenced by ExecuteSlice(), and s_ProcessListenEvent().


The documentation for this class was generated from the following file:
Modified on Tue May 28 05:49:38 2024 by modify_doxy.py rev. 669887