Skip to content

Commit

Permalink
Log new thread process IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpersaud committed Oct 2, 2024
1 parent 599ae10 commit c971a01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libstuff/libstuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <execinfo.h>
#include <sys/un.h>
#include <cxxabi.h>
Expand Down Expand Up @@ -129,6 +130,10 @@ void SInitialize(string threadName, const char* processName) {
SLogSetThreadName(threadName);
SLogSetThreadPrefix("xxxxxx ");
SInitializeSignals();

// Get the native OS thread process ID and log it
pid_t tid = syscall(SYS_gettid);
SINFO("Initializing new thread with PID: " << tid);
}

// Thread-local log prefix
Expand Down Expand Up @@ -3200,4 +3205,3 @@ SString& SString::operator=(const bool from) {
string::operator=(from ? "true" : "false");
return *this;
}

0 comments on commit c971a01

Please sign in to comment.