Reputation: 63
I have noticed that in my application, CreateProcessWithTokenW sometimes blocks for a very long time (up to 20 seconds) before returning. It is not acceptable to block my main thread for this long, so I'm considering moving the call onto a background thread. However, I'm wondering if there is a better, built-in way of doing an asynchronous CreateProcess, perhaps using overlapped operations or the like. Does anyone know whether such a thing exists?
Upvotes: 6
Views: 2275
Reputation: 613461
CreateProcess and its variants are all you've got. If the blocking hurts you then a different thread is the only solution.
Upvotes: 9