OSDN Git Service

swr/rast: quit using linux-specific gettid()
authorTim Rowley <timothy.o.rowley@intel.com>
Fri, 21 Jul 2017 16:38:39 +0000 (11:38 -0500)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 2 Aug 2017 23:19:06 +0000 (00:19 +0100)
Linux-specific gettid() syscall shouldn't be used in portable code.
Fix does assume a 1:1 thread:LWP architecture, but works for our
current target platforms and can be revisited later if needed.

Fixes unresolved symbol in linux scons builds.

v2: add comment in code about the 1:1 assumption.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
(cherry picked from commit d1e7153228304eb1be85580cbfdea1a57c5f203b)

src/gallium/drivers/swr/rasterizer/codegen/templates/gen_ar_eventhandlerfile.hpp
src/gallium/drivers/swr/rasterizer/common/os.h

index 3a618a1..9017e8d 100644 (file)
@@ -67,8 +67,9 @@ namespace ArchRast
             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", "/tmp", GetCurrentThreadId(), id);
+            // 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);
 #endif
         }
index 0b8f273..e3f2e66 100644 (file)
@@ -235,8 +235,6 @@ void AlignedFree(void* p)
 #define sprintf_s sprintf
 #define strcpy_s(dst,size,src) strncpy(dst,src,size)
 #define GetCurrentProcessId getpid
-pid_t gettid(void);
-#define GetCurrentThreadId gettid
 
 #define CreateDirectory(name, pSecurity) mkdir(name, 0777)