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();
void notify()
Informs one of the other threads who are currently blocked on wait() that the relevant condition has ...
void notify_all()
Informs all of the other threads who are currently blocked on wait() that the relevant condition has ...
void wait()
Waits on the condition.
int get_max_queue_size() const
Returns the maximum size the queue is allowed to grow to.
void shutdown()
Marks the queue as shutting down, which will eventually cause all threads blocking on extract() to re...
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.
bool insert(const NetDatagram &data, bool block=false)
Inserts the indicated datagram onto the end of the queue, and returns.
int get_current_queue_size() const
Returns the current number of things in the queue.
A lightweight C++ object whose constructor calls acquire() and whose destructor calls release() on a ...
A specific kind of Datagram, especially for sending across or receiving from a network.
virtual void clear()
Resets the datagram to empty, in preparation for building up a new datagram.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.