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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-cbc/+/21996 )
Change subject: move from gettid() to pthread_self()
......................................................................
move from gettid() to pthread_self()
Whatever you do sucks:
* gettid() doens't have a glibc wrapper function in Debian <= 9
* pthrad_self() returns an opaque pthread_t where we shouldn't really
make the assumption it's an unsigned long
Change-Id: Ida200de75333e0d35997158000def3cac89759b1
---
M src/cbc_main.c
M src/rest_it_op.c
2 files changed, 3 insertions(+), 9 deletions(-)
Approvals:
laforge: Looks good to me, approved; Verified
diff --git a/src/cbc_main.c b/src/cbc_main.c
index 84d6e16..f664afb 100644
--- a/src/cbc_main.c
+++ b/src/cbc_main.c
@@ -20,14 +20,12 @@
*
*/
-#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <signal.h>
-#include <sys/types.h>
#include <osmocom/core/stats.h>
#include <osmocom/core/select.h>
@@ -206,7 +204,7 @@
rest_api_init(tall_rest_ctx, 12345);
- LOGP(DREST, LOGL_INFO, "Main thread tid: %d\n", gettid());
+ LOGP(DREST, LOGL_INFO, "Main thread tid: %lu\n", pthread_self());
g_cbc->it_q.rest2main = osmo_it_q_alloc(g_cbc, "rest2main", 10, rest2main_read_cb, NULL);
OSMO_ASSERT(g_cbc->it_q.rest2main);
osmo_fd_register(&g_cbc->it_q.rest2main->event_ofd);
diff --git a/src/rest_it_op.c b/src/rest_it_op.c
index d928c21..b01f8ba 100644
--- a/src/rest_it_op.c
+++ b/src/rest_it_op.c
@@ -20,10 +20,6 @@
*
*/
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <sys/types.h>
-
#include <errno.h>
#include <pthread.h>
@@ -55,7 +51,7 @@
{
int rc = 0;
- LOGP(DREST, LOGL_DEBUG, "rest_it_op enqueue from %u\n", gettid());
+ LOGP(DREST, LOGL_DEBUG, "rest_it_op enqueue from %lu\n", pthread_self());
rc = osmo_it_q_enqueue(g_cbc->it_q.rest2main, op, list);
if (rc < 0)
@@ -91,7 +87,7 @@
struct rest_it_op *op = item;
struct cbc_message *cbc_msg;
- LOGP(DREST, LOGL_DEBUG, "%s(op=%p) from %u\n", __func__, op, gettid());
+ LOGP(DREST, LOGL_DEBUG, "%s(op=%p) from %lu\n", __func__, op, pthread_self());
/* FIXME: look up related message and dispatch to message FSM,
* which will eventually call pthread_cond_signal(&op->cond) */
--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/21996
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: Ida200de75333e0d35997158000def3cac89759b1
Gerrit-Change-Number: 21996
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210106/d355b3cd/attachment.htm>