Hi,
GetCurrentThreadId() works on a WIN32 machine. Can anyone tell me if GetCurrentThreadId() works on a linux machine. If it does work also let me know the header file to include.
Thanks,
Chandana.
Hi,
GetCurrentThreadId() works on a WIN32 machine. Can anyone tell me if GetCurrentThreadId() works on a linux machine. If it does work also let me know the header file to include.
Thanks,
Chandana.
Nope; that is a MS-specific call. Google for POSIX and threading, specifically pthreads to see how Linux/UNIX does it. This is why I am happy that the new C++ std is incorporating thread behavior...too many years of writing cross-platform thread code I guess but having a single standard will be great, not just from an API standpoint but also the angle of expected language behavior. Just look at the difference between setting/modifying thread priorities between platforms as it is now...ugh...
the equivalent on a platform that has pthreads as its native threading system would be pthread_self.
I need to dig through my info on the new C++ standard methods to see if pthread_self still works (doubt it is that *exactly* since this is supposed to be platform-neutral) but it might be something generalized like gettid() or something.
Caveat: I just got home from a week-long music fest and brain not totally engaged yet....
Thanks to all.