Solved

c++ queue & thread pool

Posted on 2015-01-29
5
487 Views
Last Modified: 2015-02-03
Hi Experts,

I want to create a reliable thread pool that will execute jobs from a queue.  I probably should not reinvent the wheel, but I'm not sure if something good exists.

- Is there already some implementation that I can use here?
- If not, any suggestions on the algorithm?

Thank you,
Mike
0
Comment
Question by:thready
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 40577875
Windows already comes with built-in supportr for that with mechanisms like 'QueueUserWorkItem()' (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684957(v=vs.85).aspx), see e.g. http://www.codeproject.com/Articles/33352/Full-Multi-thread-Client-Server-Socket-Class-with ("Full Multi-thread Client/Server Socket Class with ThreadPool") on how to make use of that. Alternatively, chec out http://www.codeproject.com/Articles/6863/Windows-Thread-Pooling-and-Execution-Chaining ("Windows Thread Pooling and Execution Chaining") which accomplishes the same in a little bit more C++ way.
0
 
LVL 1

Author Comment

by:thready
ID: 40578443
Thanks jkr.  I'm looking at QueueUserWorkItem first.  Interesting.
0
 
LVL 32

Expert Comment

by:phoffric
ID: 40586601
@Karrtik Iyer,

Non-compliant post deleted:
http://support.experts-exchange.com/customer/portal/articles/1162518

Please repost adhering to the terms.

Thanks,
phoffric
TA
0
 
LVL 15

Assisted Solution

by:Karrtik Iyer
Karrtik Iyer earned 250 total points
ID: 40586702
Hi,

Please check out boost threading library and its pool library.
http://www.boost.org/doc/libs/1_57_0/doc/html/thread.html
http://www.boost.org/doc/libs/1_57_0/libs/pool/doc/html/boost_pool/pool/introduction.html

Thanks,
 description of your file (required)
0
 
LVL 1

Author Closing Comment

by:thready
ID: 40587775
Both great answers, thank you!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question