c++ - Determine if a dll is being called by multiple threads from an application - Use ThreadId? -
i have created static dll file used application. wanted know if exported methods of dll being called separate threads of application or single thread. thinking if output threadid of thread calls method in dll might me figure out if function being called single thread or multiple threads. ? how threadid of thread calling dll ?
use getcurrentthreadid function.
std::vector<dword> ids; __declspec(dllexport) int __stdcall somefunction() { dword id = getcurrentthreadid(); if (std::find(ids.begin(), ids.end(), id) != ids.end()) { // new thread uses function ids.push_back(id); } }
Comments
Post a Comment