Change in osmo-trx[master]: Threads: Avoid printing pthread_self()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Mar 1 15:20:54 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/23161 )


Change subject: Threads: Avoid printing pthread_self()
......................................................................

Threads: Avoid printing pthread_self()

 The type used to represent a thread ID is implementation
specific, and may be an opaqe structure, making it unsuitable to be
printed by standard means. Let's use osmo_gettid() instead.

Change-Id: Iaa4d0eaf52b901fff06cc67f8dd8b61ac6084911
Related: OS#5032
---
M CommonLibs/Threads.cpp
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/61/23161/1

diff --git a/CommonLibs/Threads.cpp b/CommonLibs/Threads.cpp
index b3ff52f..b6750ab 100644
--- a/CommonLibs/Threads.cpp
+++ b/CommonLibs/Threads.cpp
@@ -32,7 +32,9 @@
 #include "Timeval.h"
 #include "Logger.h"
 
+extern "C" {
 #include <osmocom/core/thread.h>
+}
 
 using namespace std;
 
@@ -47,7 +49,7 @@
 {
 	gStreamLock.lock();
 	Timeval entryTime;
-	cout << entryTime << " " << pthread_self() << ": ";
+	cout << entryTime << " " << osmo_gettid() << ": ";
 }
 
 
@@ -62,7 +64,7 @@
 {
 	gStreamLock.lock();
 	Timeval entryTime;
-	cerr << entryTime << " " << pthread_self() << ": ";
+	cerr << entryTime << " " << osmo_gettid() << ": ";
 }
 
 void unlockCerr()

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/23161
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Iaa4d0eaf52b901fff06cc67f8dd8b61ac6084911
Gerrit-Change-Number: 23161
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210301/196302a7/attachment.htm>


More information about the gerrit-log mailing list