Reputation: 142
As title, I can't find any information about whether CreateToolhelp32Snapshot
, Module32First
and Toolhelp32ReadProcessMemory function
WinAPIs is thread-safe or not.
Dose anyone know about this? Or is there any way I can figure out whether those APIs are thread-safe?
MSDN: Tool Help Functions
Upvotes: 1
Views: 319
Reputation: 613053
Those functions are threadsafe in the following way. Multiple threads can call CreateToolhelp32Snapshot
and perform separate enumerations.
On the other hand, it's not a total free for all. You cannot share a single snapshot between threads and have the threads then perform unsynchronised operations on that snapshot. In fact, it would be folly to share a snapshot between multiple threads.
Upvotes: 1