Naughter Software Logo

ThreadPoolWrappers v1.03 A set of C++ classes to encapsulate the Windows Thread Pool

Included in my W3MFC download is a custom thread pool implementation which I wrote many years ago, but since Windows Vista, Microsoft have implemented a new Thread Pool API which I have always wanted to take a look at. This download provides a complete C++ wrapper for the various components of the Thread Pool API. It is based in part on the Kenny Kerr articles on the MSDN magazine about the thread pool from August to December 2011 (https://msdn.microsoft.com/en-ca/magazine/hh335066.aspx, https://msdn.microsoft.com/en-us/magazine/hh394144.aspx, https://msdn.microsoft.com/en-us/magazine/hh456398.aspx, https://msdn.microsoft.com/magazine/hh547107.aspx & https://msdn.microsoft.com/magazine/hh580731.aspx). These wrapper classes also provide an implementation of the Thread Pool sample as provided on the blog post article at http://www.dorodnic.com/blog/2015/10/17/windows-threadpool.

The classes provided are: ThreadPoolWrappers::CCleanupGroup, ThreadPoolWrappers::CEnvironment, ThreadPoolWrappers::CIO, ThreadPoolWrappers::CPool, ThreadPoolWrappers::CThreadPool, ThreadPoolWrappers::CTimer, ThreadPoolWrappers::CWait & ThreadPoolWrappers::CWork.

CCleanupGroup provides a class based encapsulation of a Thread Pool cleanup group as represented by a PTP_CLEANUP_GROUP.

CEnvironment provides a class based encapsulation of a Thread Pool TP_CALLBACK_ENVIRON structure.

CIO provides a class based encapsulation of a Thread Pool IO callback as represented by a PTP_IO.

CPool provides a class based encapsulation of a Thread Pool pool as represented by a PTP_POOL.

CThreadPool provides a implementation of a thread pool based on the blog post article at http://www.dorodnic.com/blog/2015/10/17/windows-threadpool. It works with the default process thread pool or an explicit thread pool and provides cleanup via CEnvironment and CCleanupGroup member variables.

CTimer provides a class based encapsulation of a Thread Pool timer callback as represented by a PTP_TIMER.

CWait provides a class based encapsulation of a Thread Pool wait callback as represented by a PTP_WAIT.

CWork provides a class based encapsulation of a Thread Pool work callback as represented by a PTP_WORK.

 

Features

 

The enclosed zip file contains the ThreadPoolWrappers source code and a VC 2017 console based application with exercises all of the ThreadPoolWrappers functionality.

 

Copyright

 

Usage

 

Updates

v1.03 (12 April 2020)

v1.02 (26 January 2020)

v1.01 (18 December 2019)

v1.0 (3 March 2018)