| 778 | |
| 779 | protected: |
| 780 | void load_thread_info() |
| 781 | { |
| 782 | #ifdef BACKWARD_SYSTEM_LINUX |
| 783 | # ifndef __ANDROID__ |
| 784 | _thread_id = static_cast<size_t>(syscall(SYS_gettid)); |
| 785 | # else |
| 786 | _thread_id = static_cast<size_t>(gettid()); |
| 787 | # endif |
| 788 | if (_thread_id == static_cast<size_t>(getpid())) { |
| 789 | // If the thread is the main one, let's hide that. |
| 790 | // I like to keep little secret sometimes. |
| 791 | _thread_id = 0; |
| 792 | } |
| 793 | #elif defined(BACKWARD_SYSTEM_DARWIN) |
| 794 | _thread_id = reinterpret_cast<size_t>(pthread_self()); |
| 795 | if (pthread_main_np() == 1) { |
| 796 | // If the thread is the main one, let's hide that. |
| 797 | _thread_id = 0; |
| 798 | } |
| 799 | #endif |
| 800 | } |
| 801 | |
| 802 | void set_context(void* context) { _context = context; } |
| 803 | void* context() const { return _context; } |
nothing calls this directly
no outgoing calls
no test coverage detected