Hi, I think it would be nice to get the native ids of the/a running thread additionally to Poco::Thread::id(), which only returns an internal id not representing the actually assigned by the system, e.g. seen with "top" or "ps" on UNIX machines or within the task manager on Windows.
- Code: Select all
#if defined(POCO_OS_FAMILY_WINDOWS)
#include <windows.h>
#elif defined(POCO_OS_FAMILY_UNIX)
#include <sys/syscall.h>
#endif
// should be renamed to static Poco::Thread::getCurrentThreadId() or something similar
// returning the id of the thread this function is called within
inline unsigned long getCurrentThreadID() {
#if defined(POCO_OS_FAMILY_WINDOWS)
return (unsigned long)GetCurrentThreadId();
#elif defined(POCO_OS_FAMILY_UNIX)
return (unsigned long)syscall(SYS_gettid);
#else
// should use Poco::Thread::id() instead
return 0;
#endif
}