views:

153

answers:

1

Hi Folks,

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 http://stackoverflow.com/questions/331536/windows-threading-beginthread-vs-beginthreadex-vs-createthread-c

+1  A: 

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.

Hans Passant