Returns a thread ID given a pthread_t. This wraps pthread_threadid_np() but that function has a cumbersome interface because it returns a success value. This function CHECKs success and returns the thread ID directly.
| 152 | // that function has a cumbersome interface because it returns a success value. |
| 153 | // This function CHECKs success and returns the thread ID directly. |
| 154 | uint64_t PthreadToThreadID(pthread_t pthread) { |
| 155 | uint64_t thread_id; |
| 156 | errno = pthread_threadid_np(pthread, &thread_id); |
| 157 | PCHECK(errno == 0) << "pthread_threadid_np"; |
| 158 | return thread_id; |
| 159 | } |
| 160 | |
| 161 | TEST(ProcessReaderMac, SelfOneThread) { |
| 162 | const ScopedSetThreadName scoped_set_thread_name( |
no outgoing calls
no test coverage detected