ost::SocketService(3)
π ost::SocketService(3) π
okay bestie, welcome to the Library Functions Manual entry for ost::SocketService</p> β yes it's a C++ class, yes it's from GNU CommonC++, yes we're gonna make it make sense. grab a boba, we're doing this. π§β¨
πΈ NAME πΈ
ost::SocketService</p> β the SocketService is a thread pool object that is meant to service attached socket ports. that's it. that's the whole vibe. π
β¨ SYNOPSIS β¨
#include <socketport.h>
so here's the family tree moment: it Inherits ost::Thread, and ost::Mutex. it's giving main character with two iconic parents fr fr. π
π«Ά Public Member Functions
void update (unsigned char flag=0xff)β Notify service thread that a port has been added or removed, or a timer changed, so that a new schedule can be computed for expiring attached ports.SocketService (int pri=0, size_t stack=0, const char *id=NULL)β Create a service thread for attaching socket ports.virtual ~SocketService ()β Terminate the thread pool and eliminate any attached socket ports.int getCount (void) constβ Get current reference count.
π Protected Member Functions
virtual void onUpdate (unsigned char buf)β Handles all requests other than 'termination'.virtual void onEvent (void)β Called once each time the service thread is rescheduled.virtual void onCallback (SocketPort *port)β Called for each port that is being processed in response to an event.
π Friends
class SocketPort
π Additional Inherited Members
(yes there's more, it's a whole inheritance situation, we don't gatekeep)
π Detailed Description π
The SocketService is a thread pool object that is meant to service attached socket ports.
Multiple pool objects may be created and multiple socket ports may be attached to the same thread of execution. This allows one to balance threads and sockets they service rather than either using a single thread for all connections or a separate thread for each connection. Features can be added through supported virtual methods.
Author
David Sugar dyfet@ostel.com
Thread pool service object for socket ports.
Examples
tcpservice.cpp.
π Constructor & Destructor Documentation π
ost::SocketService::SocketService (int pri = 0, size_t stack = 0, const char * id = NULL)
Create a service thread for attaching socket ports. The thread begins execution with the first attached socket. lowkey the moment it wakes up, it's already clocked in. π
Parameters
- pri β of this thread to run under.
- stack β stack size.
- id β thread ID.
virtual ost::SocketService::~SocketService () [virtual]
Terminate the thread pool and eliminate any attached socket ports. it's the goodbye arc. π
π Member Function Documentation π
int ost::SocketService::getCount (void) const [inline]
Get current reference count. This can be used when selecting the least used service handler from a pool. the "who's got the least on their plate rn" check bestie. π«Ά
Returns
- count of active ports.
virtual void ost::SocketService::onCallback (SocketPort * port) [protected], [virtual]
Called for each port that is being processed in response to an event. This can be used to add additional notification options during callback in combination with update().
Parameters
- port β SocketPort who's callback events are being evaluated.
virtual void ost::SocketService::onEvent (void) [protected], [virtual]
Called once each time the service thread is rescheduled. This is called after the mutex is locked and can be used to slip in additional processing. sneaking extra work in after the lock? that's the move. π₯
virtual void ost::SocketService::onUpdate (unsigned char buf) [protected], [virtual]
Handles all requests other than 'termination'.
Parameters
- buf β request id as posted from
update().
void ost::SocketService::update (unsigned char flag = 0xff)
Notify service thread that a port has been added or removed, or a timer changed, so that a new schedule can be computed for expiring attached ports. A '0' is used to terminate the service thread, and additional values can be specified which will be 'caught' in the onUpdate() handler.
ngl bestie, remember that '0' = terminate. it's the off switch. don't send it by accident. π
Parameters
- flag β update flag value.
π Friends And Related Function Documentation π
friend class SocketPort [friend]
just besties being besties, no cap. π«Ά
β Author β
Generated automatically by Doxygen for GNU CommonC++ from the source code.
and that's the whole page babes!! this lil beauty is from GNU CommonC++, dated Sun Dec 27 2020, and it's page ost::SocketService(3) of the manual β so if anyone asks, you read it, you understood it, you ate. periodt. ππβ¨
π¦ where this page comes from
- ubuntu jammy: libcommoncpp2-doc 1.8.1-10
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms