ost::ThreadQueue(3)

๐Ÿ“ฆ version 1.8.1, in ubuntu jammy

๐Ÿ’– NAME ๐Ÿ’–

ost::ThreadQueue โ€” the somewhat generic queue processing class that pulls off a whole producerโ€“consumer queue situation โœจ

this page is from the Library Functions Manual, bestie ๐Ÿซถ

๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <buffer.h>

okay so it inherits from ost::Mutex, ost::Thread, and ost::Semaphore โ€” triple inheritance, she's doing the most and we love that for her ๐Ÿ’…

๐ŸŽ€ Classes ๐ŸŽ€

  • struct _data

๐ŸŒˆ Public Member Functions ๐ŸŒˆ

  • ThreadQueue (const char *id, int pri, size_t stack=0) โ€” create an instance of our queue and give it a process priority โœจ
  • virtual ~ThreadQueue () โ€” destroy the queue ๐Ÿ’€
  • void setTimer (timeout_t timeout) โ€” set the queue timeout โฐ
  • void post (const void *data, unsigned len) โ€” put some unspecified data into this queue ๐Ÿ“ฎ

๐Ÿฆ‹ Protected Types ๐Ÿฆ‹

  • typedef struct ost::ThreadQueue::_data data_t

๐Ÿ’œ Protected Member Functions ๐Ÿ’œ

  • virtual void final ()
  • virtual void startQueue (void) โ€” start of dequeing ๐Ÿ
  • virtual void stopQueue (void) โ€” end of dequeing, we expect the queue is empty for now ๐Ÿ›‘
  • virtual void onTimer (void) โ€” a derivable method to call when the timout is expired โณ
  • virtual void runQueue (void *data)=0 โ€” virtual callback method to handle processing of a queued data items ๐Ÿ”ฅ

๐Ÿ“ Protected Attributes ๐Ÿ“

  • timeout_t timeout
  • bool started
  • data_t * first
  • data_t * last
  • String name

๐Ÿ‘‘ Additional Inherited Members ๐Ÿ‘‘

ngl this heading is giving "placeholder that never got filled in" โ€” there is literally nothing under it on the page, it just vibes there. Iconic of the docs tbh. ๐Ÿ™ˆ


๐Ÿ’– Detailed Description ๐Ÿ’–

Somewhat generic queue processing class to establish a producer consumer queue.

This may be used to buffer cdr records, or for other purposes where an in-memory queue is needed for rapid posting. This class is derived from Mutex and maintains a linked list. A thread is used to dequeue data and pass it to a callback method that is used in place of run for each item present on the queue. The conditional is used to signal the run thread when new data is posted. ๐Ÿงตโœจ

This class was changed by Angelo Naselli to have a timeout on the queue ๐Ÿ’…

in memory data queue interface.

๐ŸŒŸ Author ๐ŸŒŸ

  • David Sugar dyfet@ostel.com

๐Ÿฆ‹ Member Typedef Documentation ๐Ÿฆ‹

typedef struct ost::ThreadQueue::_data ost::ThreadQueue::data_t [protected]


๐ŸŽ€ Constructor & Destructor Documentation ๐ŸŽ€

ost::ThreadQueue::ThreadQueue (const char * id, int pri, size_t stack = 0)

Create instance of our queue and give it a process priority โœจ

Parameters

  • id โ€” queue ID.
  • pri โ€” process priority.
  • stack โ€” stack size.

virtual ost::ThreadQueue::~ThreadQueue () [virtual]

Destroy the queue ๐Ÿ’€


๐ŸŒˆ Member Function Documentation ๐ŸŒˆ

virtual void ost::ThreadQueue::final () [protected], [virtual]

Reimplemented from ost::Thread.

virtual void ost::ThreadQueue::onTimer (void) [protected], [virtual]

A derivable method to call when the timout is expired โณ

void ost::ThreadQueue::post (const void * data, unsigned len)

Put some unspecified data into this queue. A new qd structure is created and sized to contain a copy of the actual content ๐Ÿ“ฎ

Parameters

  • data โ€” pointer to data.
  • len โ€” size of data.

virtual void ost::ThreadQueue::runQueue (void * data) [protected], [pure virtual]

Virtual callback method to handle processing of a queued data items. After the item is processed, it is deleted from memory. We can call multiple instances of runQueue in order if multiple items are waiting ๐Ÿ”ฅ

Parameters

  • data โ€” item being dequed.

void ost::ThreadQueue::setTimer (timeout_t timeout)

Set the queue timeout. When the timer expires, the onTimer() method is called for the thread โฐ

Parameters

  • timeout โ€” timeout in milliseconds.

virtual void ost::ThreadQueue::startQueue (void) [protected], [virtual]

Start of dequeing. Maybe we need to connect a database or something, so we have a virtual... ๐Ÿ

virtual void ost::ThreadQueue::stopQueue (void) [protected], [virtual]

End of dequeing, we expect the queue is empty for now. Maybe we need to disconnect a database or something, so we have another virtual. ๐Ÿ›‘


๐Ÿ’œ Member Data Documentation ๐Ÿ’œ

data_t* ost::ThreadQueue::first [protected]

data_t * ost::ThreadQueue::last [protected]

String ost::ThreadQueue::name [protected]

bool ost::ThreadQueue::started [protected]

timeout_t ost::ThreadQueue::timeout [protected]


โญ Author โญ

Generated automatically by Doxygen for GNU CommonC++ from the source code. โœจ


okay bestie that's the whole page, no cap, every last flag and detail accounted for ๐Ÿซถ this lil manpage came from GNU CommonC++ and it was dated Sun Dec 27 2020 โ€” periodt, slay, go build something with a queue in it ๐Ÿ’–๐Ÿ’…๐ŸŽ€

๐Ÿ“ฆ where this page comes from