platform/unix.c
changeset 452 89578e99ba6e
parent 396 15f7ccfdd89f
child 505 c7f7f234a156
equal deleted inserted replaced
451:4579e942ef95 452:89578e99ba6e
   288 int __PHYSFS_platformGrabMutex(void *mutex) { return(1); }
   288 int __PHYSFS_platformGrabMutex(void *mutex) { return(1); }
   289 void __PHYSFS_platformReleaseMutex(void *mutex) {}
   289 void __PHYSFS_platformReleaseMutex(void *mutex) {}
   290 
   290 
   291 #else
   291 #else
   292 
   292 
   293 #define PHTREAD_TO_UI64(thr) ((PHYSFS_uint64) (thr))
   293 /* Just in case; this is a panic value. */
       
   294 #if ((!defined SIZEOF_INT) || (SIZEOF_INT <= 0))
       
   295 #  define SIZEOF_INT 4
       
   296 #endif
       
   297 
       
   298 #if (SIZEOF_INT == 4)
       
   299 #  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint32) (thr)) )
       
   300 #elif (SIZEOF_INT == 2)
       
   301 #  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint16) (thr)) )
       
   302 #elif (SIZEOF_INT == 1)
       
   303 #  define PHTREAD_TO_UI64(thr) ( (PHYSFS_uint64) ((PHYSFS_uint8) (thr)) )
       
   304 #else
       
   305 #  define PHTREAD_TO_UI64(thr) ((PHYSFS_uint64) (thr))
       
   306 #endif
   294 
   307 
   295 PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
   308 PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
   296 {
   309 {
   297     return(PHTREAD_TO_UI64(pthread_self()));
   310     return(PHTREAD_TO_UI64(pthread_self()));
   298 } /* __PHYSFS_platformGetThreadID */
   311 } /* __PHYSFS_platformGetThreadID */