Solved

c++ queue & thread pool

Posted on 2015-01-29
5
447 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
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2013: API code to put hidden database icon in taskbar? 8 87
Need more details 5 168
Which Linux flavors will this run on? 6 96
Please explain purpose of GZIP 4 36
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

829 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