Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 552
  • Last Modified:

c++ queue & thread pool

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
thready
Asked:
thready
2 Solutions
 
jkrCommented:
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
 
threadyAuthor Commented:
Thanks jkr.  I'm looking at QueueUserWorkItem first.  Interesting.
0
 
phoffricCommented:
@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
 
Karrtik IyerSoftware ArchitectCommented:
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
 
threadyAuthor Commented:
Both great answers, thank you!
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now