ost::SocketService(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

πŸ’– 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.

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