MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / load_thread_info

Method load_thread_info

src/backward.h:780–800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

778
779protected:
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; }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected