From: Mikko Rasa Date: Fri, 9 Dec 2022 19:51:20 +0000 (+0200) Subject: Use deque instead of list for resolver task queue X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b91b37fd6534a8e546fd6f5d6ddd91d66cd0519f;p=libs%2Fnet.git Use deque instead of list for resolver task queue --- diff --git a/source/net/resolve.cpp b/source/net/resolve.cpp index 006f210..cd65b9c 100644 --- a/source/net/resolve.cpp +++ b/source/net/resolve.cpp @@ -211,7 +211,7 @@ void Resolver::WorkerThread::main() Task *task = 0; { MutexLock lock(queue_mutex); - for(list::iterator i=queue.begin(); (!task && i!=queue.end()); ++i) + for(deque::iterator i=queue.begin(); (!task && i!=queue.end()); ++i) if(!i->is_complete()) task = &*i; } diff --git a/source/net/resolve.h b/source/net/resolve.h index 21737ff..5e7781d 100644 --- a/source/net/resolve.h +++ b/source/net/resolve.h @@ -1,6 +1,7 @@ #ifndef MSP_NET_RESOLVE_H_ #define MSP_NET_RESOLVE_H_ +#include #include #include #include @@ -50,7 +51,7 @@ private: class WorkerThread: public Thread { private: - std::list queue; + std::deque queue; Mutex queue_mutex; Semaphore sem; IO::Pipe notify_pipe;