m_MaxThreads < m_InitThreads || m_MaxThreads > 1000) {
87 "CThreadedServer::Run: Bad parameters");
132pool.KillAllThreads(
true);
138 switch(GetErrCode()) {
CThreadedServer & m_Server
virtual void Process(void)
Do the actual job Called by whichever thread handles this request.
CSocketRequest(CThreadedServer &server, SOCK sock)
Exceptions thrown by CThreadedServer::Run.
@ eNoOwnership
No ownership is assumed.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define STD_CATCH_ALL_X(err_subcode, message)
Standard handling of "exception"-derived exceptions; catches non-standard exceptions and generates "u...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
#define NCBI_RESUME_DEPRECATION_WARNINGS
#define NCBI_SUSPEND_DEPRECATION_WARNINGS
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
EOwnership SetOwnership(EOwnership if_to_own)
Specify if this "CSocket" is to own the underlying "SOCK".
EIO_Status Listen(unsigned short port, unsigned short backlog=64, TSOCK_Flags flags=fSOCK_LogDefault, ESwitch ipv6=eDefault)
EIO_Status Accept(CSocket *&sock, const STimeout *timeout=kInfiniteTimeout, TSOCK_Flags flags=fSOCK_LogDefault) const
SOCK GetSOCK(void) const
Access to the underlying "SOCK".
EIO_Status GetStatus(void) const
Return eIO_Closed if not yet bound or Close()'d.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
CListeningSocket m_LSock
Listening socket.
NCBI_DEPRECATED_CLASS NCBI_XCONNECT_EXPORT CThreadedServer
CThreadedServer - abstract class for network servers using thread pools.
const STimeout * m_AcceptTimeout
Maximum time between exit checks.
unsigned int m_QueueSize
Maximum size of request queue.
void Run(void)
Enter the main loop.
unsigned short m_Port
TCP port to listen on.
unsigned int m_InitThreads
Settings for thread pool (which is local to Run):
void StartListening(void)
Start listening immediately, or throw an exception if it is impossible to do so.
virtual const char * GetErrCodeString(void) const override
bool m_TemporarilyStopListening
Temporarily close listener when queue fills?
virtual bool ShutdownRequested(void)
Runs synchronously between iterations.
virtual void ProcessOverflow(SOCK sock)
Runs synchronously when request queue is full.
virtual void ProcessTimeout(void)
Runs synchronously when accept has timed out.
unsigned int m_MaxThreads
Maximum simultaneous threads.
virtual void SetParams()
Called at the beginning of Run, before creating thread pool.
unsigned int m_SpawnThreshold
Controls when to spawn more threads.
@ eBadParameters
Out-of-range parameters given.
@ eCouldntListen
Unable to bind listening port.
unsigned int usec
microseconds (modulo 1,000,000)
const char * IO_StatusStr(EIO_Status status)
Get the text form of an enum status value.
@ eIO_Timeout
timeout expired before any I/O succeeded
@ eIO_Success
everything is fine, no error occurred
Definition of all error codes used in connect library (xconnect.lib, xconnext.lib etc).
Pool of generic task-executing threads.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4