]> git.tdb.fi Git - libs/net.git/commitdiff
Use deque instead of list for resolver task queue
authorMikko Rasa <tdb@tdb.fi>
Fri, 9 Dec 2022 19:51:20 +0000 (21:51 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 9 Dec 2022 19:51:20 +0000 (21:51 +0200)
source/net/resolve.cpp
source/net/resolve.h

index 006f210d777eb2aa38d7e5df91ecc1c25ca20c0d..cd65b9caccc66b6fb0a88f813850ea387d9ffaac 100644 (file)
@@ -211,7 +211,7 @@ void Resolver::WorkerThread::main()
                Task *task = 0;
                {
                        MutexLock lock(queue_mutex);
-                       for(list<Task>::iterator i=queue.begin(); (!task && i!=queue.end()); ++i)
+                       for(deque<Task>::iterator i=queue.begin(); (!task && i!=queue.end()); ++i)
                                if(!i->is_complete())
                                        task = &*i;
                }
index 21737ff4794bb0def530bd364cae00a2291ec1c2..5e7781dfc64a3e66bf16d1b02c8beed05aaefc83 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_NET_RESOLVE_H_
 #define MSP_NET_RESOLVE_H_
 
+#include <deque>
 #include <string>
 #include <msp/core/mutex.h>
 #include <msp/core/semaphore.h>
@@ -50,7 +51,7 @@ private:
        class WorkerThread: public Thread
        {
        private:
-               std::list<Task> queue;
+               std::deque<Task> queue;
                Mutex queue_mutex;
                Semaphore sem;
                IO::Pipe notify_pipe;