Win32 Threadpool Tutorial Recap

Download source code from MSDN Code Gallery. This is a quick recap of all the posts in the threadpool series and the methods supported by the wrapper classes.   Introduction to the Windows Threadpool (Part 1) Threadpool Work item priority Introduction to the Windows Threadpool (part 2) Threadpool Timer Functions Waiting on Events from within…


Waiting on Events from within Threadpool

Download source code from MSDN Code Gallery.   Till now we have seen how to use the default process-wide threadpool to submit work items, how to create your own private threadpool and how to create timer objects to execute callbacks when the timer fires. In this post (final one in the threadpool series), we will…


Threadpool Timer Functions

Download source code from MSDN Code Gallery. The threadpool provides timer functionality with the SetThreadpoolTimer and CreateThreadpoolTimer functions; the ability to call your functions at specified times.  In this blog post I will show how to use the wrapper windowsthreadpool::Timer class provided to obtain timer functionality by using these APIs.   Example code: void CALLBACK…


Introduction to the Windows Threadpool (part 2)

Download source code from MSDN Code Gallery. In the previous posts, I talked about using the windowsthreadpool::SimpleThreadPool class to queue work items to the process-wide threadpool and queuing work items with different priorities.  In this post, I will show how to create your own private threadpool using the class windowsthreadpool::PrivateThreadPool. Private Threadpool The private threadpool…


Threadpool Work item priority

Download source code from MSDN Code Gallery. In the previous post, I talked about how to queue work items to the process-wide system threadpool using TrySubmitThreadpoolCallback. In this post, I will talk about work item priority and how to queue low priority work items.  The thread that your work item executes is not owned by…


Introduction to the Windows Threadpool (Part 1)

Download source code from MSDN Code Gallery.   I regularly receive feedback that the Win32 Threadpool API is complex and there is a need for better examples. To improve this situation, I decided to create three wrapper C++ classes which provide the following; queuing work items, associating callbacks with events and timer functionality. You can…