|
@@ -66,6 +66,32 @@ get_current_queue_size() const {
|
|
|
return size;
|
|
return size;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: QueuedReturn::get_overflow_flag
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Returns true if the queue has overflowed since the
|
|
|
|
|
+// last call to reset_overflow_flag() (implying that
|
|
|
|
|
+// some elements have been dropped from the queue), or
|
|
|
|
|
+// false otherwise.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+template<class Thing>
|
|
|
|
|
+bool QueuedReturn<Thing>::
|
|
|
|
|
+get_overflow_flag() const {
|
|
|
|
|
+ return _overflow_flag;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: QueuedReturn::reset_overflow_flag
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Resets the overflow flag so that get_overflow_flag()
|
|
|
|
|
+// will return false until a new overflow occurs.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+template<class Thing>
|
|
|
|
|
+void QueuedReturn<Thing>::
|
|
|
|
|
+reset_overflow_flag() {
|
|
|
|
|
+ _overflow_flag = false;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: QueuedReturn::Constructor
|
|
// Function: QueuedReturn::Constructor
|
|
|
// Access: Protected
|
|
// Access: Protected
|
|
@@ -77,6 +103,7 @@ QueuedReturn() {
|
|
|
_mutex = PR_NewLock();
|
|
_mutex = PR_NewLock();
|
|
|
_available = false;
|
|
_available = false;
|
|
|
_max_queue_size = get_net_max_response_queue();
|
|
_max_queue_size = get_net_max_response_queue();
|
|
|
|
|
+ _overflow_flag = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -147,6 +174,8 @@ enqueue_thing(const Thing &thing) {
|
|
|
bool enqueue_ok = ((int)_things.size() < _max_queue_size);
|
|
bool enqueue_ok = ((int)_things.size() < _max_queue_size);
|
|
|
if (enqueue_ok) {
|
|
if (enqueue_ok) {
|
|
|
_things.push_back(thing);
|
|
_things.push_back(thing);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ _overflow_flag = true;
|
|
|
}
|
|
}
|
|
|
_available = true;
|
|
_available = true;
|
|
|
PR_Unlock(_mutex);
|
|
PR_Unlock(_mutex);
|
|
@@ -176,6 +205,9 @@ enqueue_unique_thing(const Thing &thing) {
|
|
|
// It was already there; return false to indicate this.
|
|
// It was already there; return false to indicate this.
|
|
|
enqueue_ok = false;
|
|
enqueue_ok = false;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ _overflow_flag = true;
|
|
|
}
|
|
}
|
|
|
_available = true;
|
|
_available = true;
|
|
|
PR_Unlock(_mutex);
|
|
PR_Unlock(_mutex);
|