Tom
Tom

Reputation: 1394

How to create multiple threads for the completion port?

Multiple threads can dequeue completion packets from a single completion port using the GetQueuedCompletionStatus() function. Is there a special function that creates these threads? Or I simply use for example CreateThread() or _beginthreadex() and create as much threads as I need?

Upvotes: 1

Views: 306

Answers (1)

Len Holgate
Len Holgate

Reputation: 21616

There is nothing special about a thread that calls GetQueuedCompletionStatus() on a given IOCP. Any thread can do it. Therefore you can create your "I/O threads" using the usual thread creation functions. In general it's best to use _beginthreadex() unless you're writing code for platforms that do not support it OR you are not linking with the CRT.

Upvotes: 1

Related Questions