Go to the documentation of this file.
23 _cvlock(
"DatagramQueue::_cvlock"),
27 _max_queue_size = get_net_max_write_queue();
69 bool enqueue_ok = ((int)_queue.size() < _max_queue_size);
71 while (!enqueue_ok && !_shutdown) {
73 enqueue_ok = ((int)_queue.size() < _max_queue_size);
78 _queue.push_back(data);
106 while (_queue.empty() && !_shutdown) {
114 nassertr(!_queue.empty(),
false);
115 result = _queue.front();
135 _max_queue_size = max_size;
144 return _max_queue_size;
153 int size = _queue.size();
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a ...
int get_current_queue_size() const
Returns the current number of things in the queue.
void set_max_queue_size(int max_size)
Sets the maximum size the queue is allowed to grow to.
bool extract(NetDatagram &result)
Extracts a datagram from the head of the queue, if one is available.
virtual void clear()
Resets the datagram to empty, in preparation for building up a new datagram.
void notify()
Informs one of the other threads who are currently blocked on wait() that the relevant condition has ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void wait()
Waits on the condition.
void shutdown()
Marks the queue as shutting down, which will eventually cause all threads blocking on extract() to re...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A specific kind of Datagram, especially for sending across or receiving from a network.
void notify_all()
Informs all of the other threads who are currently blocked on wait() that the relevant condition has ...
int get_max_queue_size() const
Returns the maximum size the queue is allowed to grow to.
bool insert(const NetDatagram &data, bool block=false)
Inserts the indicated datagram onto the end of the queue, and returns.