Expose native thread id

This commit is contained in:
Dr. Chat 2015-07-24 18:41:53 -05:00
parent 3cd748a234
commit e7def962f3
2 changed files with 4 additions and 0 deletions

View File

@ -343,6 +343,9 @@ class Thread : public WaitHandle {
// threads that had been waiting for the thread to terminate. // threads that had been waiting for the thread to terminate.
static void Exit(int exit_code); static void Exit(int exit_code);
// Returns the ID of the thread
virtual uint32_t id() const = 0;
// Returns the current name of the thread, if previously specified. // Returns the current name of the thread, if previously specified.
std::string name() const { return name_; } std::string name() const { return name_; }

View File

@ -358,6 +358,7 @@ class Win32Thread : public Win32Handle<Thread> {
} }
int32_t priority() override { return GetThreadPriority(handle_); } int32_t priority() override { return GetThreadPriority(handle_); }
uint32_t id() const override { return GetThreadId(handle_); }
void set_priority(int32_t new_priority) override { void set_priority(int32_t new_priority) override {
SetThreadPriority(handle_, new_priority); SetThreadPriority(handle_, new_priority);