Search code examples
c++frameworksexecution

Task Execution Framework for VC++?


Does anyone know of a Java ExecutorService equivlent in VC++ 2008? What I want is a framework which I can pass tasks to fixed size thread pool. The framework should manage the thread pool itself (i.e. creation and destruction of threads).


Solution

  • Vista has a new thread pool API (in addition to existing, rather spartan thread pool API windows has had for a while): http://msdn.microsoft.com/en-us/library/ms686766%28VS.85%29.aspx . This API is not bound to any specific version of MSVC/VS but of course to use the new stuff you need to have Vista/Server 2008 or better. QueueUserWorkItem and RegisterWaitForSingleObject may be sufficient for your needs. As Nikola points out, 2010 will have the PPL. .NET also has some nice thread pool apis if you can code against C# or maybe C++/CLI instead of C++.