Windows Threading: beginthread or QueueUserWorkItem (C++)

2.7k Views Asked by At

I am wondering whether to use beginthread or QueueUserWorkItem for threaded methods in C++. What are the differences between the two APIs and in what context are they better suited?

Thanks,

BTW, I have read this question Windows threading: _beginthread vs _beginthreadex vs CreateThread C++

2

There are 2 best solutions below

0
On BEST ANSWER

QUWI uses a thread from the thread pool to execute the callback function. Such threads are very light weight but not suitable for all types of threaded tasks. Basic requirements are that they need to be relatively short-lived, don't block very often and are not time critical.

It is all rather well explained in the SDK topic.

0
On

The system does a better job at managing threads than an app. Just use the system thread pool and be done with it.