A simple thread's pool in C++ with thread priorities [duplicate] - c++

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
threadpool in c++
I need to write my own or use already written thread's pool in C++ with priorities. Boost threadpool is too complicated. Please, advice me one.

If you have a basic understanding of how to write a simple threadpool with std::queue, change std::queue to std::priority_queue and you will get a threadpool with priorities

Related

Pool based memory allocation for multi thread application

What are the available improved Performance with Custom Pool Allocators? (e.x. in terms of the multi-thread access to the pool)
Or let's say: Is there any updated answer to this question?
Can multithreading speed up memory allocation? This question was asked more than 5 years ago. So I guess some updated answers would be helpful.

How could I know how much CPU time is used by all threads? [duplicate]

This question already has answers here:
How to determine CPU and memory consumption from inside a process
(10 answers)
Closed 7 years ago.
I have a few threads in my program - run on Windows and write in C++.
How can I know in the end of the running how much CPU time is used by all or one of them?
You can use the GetThreadTimes function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683237%28v=vs.85%29.aspx

Are find and read operations on std::map threadsafe? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Thread safety of std::map for read-only operations
Having std::map a can we do a.find(...)->second in multiple threads at the same time on it?
Yes. As long as none of your threads do a write
i.e. Construct the data structure in memory
Use as many threads to find/read as you require.
If the leaf needs altering put a mutex there.

c++ design pattern question. single interface multiple implementations? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How do you declare an interface in C++?
Hi,
What's the preferable way to create single interface and multiple implementations in c++?
For example, I'd like to implement kqueue for mac and epoll for linux and share the interface.
Thank you
The Strategy Pattern is probably what you are looking for.
The Abstract Factory Pattern can help you fill in the right implementation when starting up.

What is a thread pool in C++ and how it is implemented? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I just came across a new term: thread pool. I don't know what it is, can any ody offer some information about this?
What it is a thread pool and how it is implemented?
Is a thread pool just a collection of threads?
ThreadPool is basically collection of threads. Whenever a task is assigned to the threadpool, the available thread accepts the task and executes it.
The advantages of thread pool is to control the threads creation\destruction and also, optimize the thread usage.
Thread Pool concept is not the C++ language feature. There are many custom implementation of thread Pool. ( Using different strategies).
You can also read
thread pool in .NET
The threadpool library
to know
more.