diff options
author | Monty Brandenberg <monty@lindenlab.com> | 2012-07-06 19:14:42 -0400 |
---|---|---|
committer | Monty Brandenberg <monty@lindenlab.com> | 2012-07-06 19:14:42 -0400 |
commit | d2af82aafc9ef569c9552f269ccf4e4fd38a1f33 (patch) | |
tree | c4155cc15573361f1521309087de54425500b7d3 /indra/llcorehttp/_httpreadyqueue.h | |
parent | f37b90df5046fbe50309beada01022e35c5aa424 (diff) |
Experiment with ignoring priority in the library. Let upper layers
sort things out or use policy classes (eventually) to arrange low
and high priority traffic. Subjectively, I think this works better
in practice (as I haven't implemented a dynamic priority setter yet).
Diffstat (limited to 'indra/llcorehttp/_httpreadyqueue.h')
-rw-r--r-- | indra/llcorehttp/_httpreadyqueue.h | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/indra/llcorehttp/_httpreadyqueue.h b/indra/llcorehttp/_httpreadyqueue.h index 87828834dc..968ca01258 100644 --- a/indra/llcorehttp/_httpreadyqueue.h +++ b/indra/llcorehttp/_httpreadyqueue.h @@ -30,6 +30,7 @@ #include <queue> +#include "_httpinternal.h" #include "_httpoprequest.h" @@ -47,10 +48,18 @@ namespace LLCore /// Threading: not thread-safe. Expected to be used entirely by /// a single thread, typically a worker thread of some sort. +#if LLCORE_READY_QUEUE_IGNORES_PRIORITY + +typedef std::deque<HttpOpRequest *> HttpReadyQueueBase; + +#else + typedef std::priority_queue<HttpOpRequest *, std::deque<HttpOpRequest *>, LLCore::HttpOpRequestCompare> HttpReadyQueueBase; +#endif // LLCORE_READY_QUEUE_IGNORES_PRIORITY + class HttpReadyQueue : public HttpReadyQueueBase { public: @@ -66,16 +75,40 @@ protected: void operator=(const HttpReadyQueue &); // Not defined public: + +#if LLCORE_READY_QUEUE_IGNORES_PRIORITY + // Types and methods needed to make a std::deque look + // more like a std::priority_queue, at least for our + // purposes. + typedef HttpReadyQueueBase container_type; + + const_reference & top() const + { + return front(); + } + + void pop() + { + pop_front(); + } + + void push(const value_type & v) + { + push_back(v); + } + +#endif // LLCORE_READY_QUEUE_IGNORES_PRIORITY + const container_type & get_container() const { - return c; + return *this; } container_type & get_container() { - return c; + return *this; } - + }; // end class HttpReadyQueue |