mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 21:40:08 +01:00
swr/rast: threadID via portable std::this_thread::get_id()
Replace use of Win32 GetCurrentThreadId() with portable std::this_thread::get_id(). Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
This commit is contained in:
parent
95c6a97464
commit
e1091b0861
1 changed files with 11 additions and 9 deletions
|
|
@ -36,6 +36,7 @@
|
|||
#include "${event_header}"
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
|
||||
namespace ArchRast
|
||||
{
|
||||
|
|
@ -56,21 +57,22 @@ namespace ArchRast
|
|||
std::stringstream outDir;
|
||||
outDir << KNOB_DEBUG_OUTPUT_DIR << pBaseName << "_" << pid << std::ends;
|
||||
CreateDirectory(outDir.str().c_str(), NULL);
|
||||
|
||||
char buf[255];
|
||||
|
||||
// There could be multiple threads creating thread pools. We
|
||||
// want to make sure they are uniquly identified by adding in
|
||||
// the creator's thread id into the filename.
|
||||
sprintf(buf, "%s\\ar_event%d_%d.bin", outDir.str().c_str(), GetCurrentThreadId(), id);
|
||||
mFilename = std::string(buf);
|
||||
std::stringstream fstr;
|
||||
fstr << outDir.str().c_str() << "\\ar_event" << std::this_thread::get_id();
|
||||
fstr << "_" << id << ".bin" << std::ends;
|
||||
mFilename = fstr.str();
|
||||
#else
|
||||
char buf[255];
|
||||
// There could be multiple threads creating thread pools. We
|
||||
// want to make sure they are uniquly identified by adding in
|
||||
// the creator's thread (process) id into the filename.
|
||||
// Assumes a 1:1 thread:LWP mapping as in linux.
|
||||
sprintf(buf, "%s/ar_event%d_%d.bin", "/tmp", GetCurrentProcessId(), id);
|
||||
mFilename = std::string(buf);
|
||||
// the creator's thread id into the filename.
|
||||
std::stringstream fstr;
|
||||
fstr << "/tmp/ar_event" << std::this_thread::get_id();
|
||||
fstr << "_" << id << ".bin" << std::ends;
|
||||
mFilename = fstr.str();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue