Skip to content

feat: set names to threads#184

Open
jesterhodl wants to merge 1 commit intoOCEAN-xyz:masterfrom
jesterhodl:pthread-setname
Open

feat: set names to threads#184
jesterhodl wants to merge 1 commit intoOCEAN-xyz:masterfrom
jesterhodl:pthread-setname

Conversation

@jesterhodl
Copy link
Copy Markdown
Contributor

@jesterhodl jesterhodl commented Apr 6, 2026

Fixes #148

BEFORE:
ps -T -p 2987412 -o pid,tid,comm,args
    PID     TID COMMAND         COMMAND
2987412 2987412 datum_gateway   ./datum_gateway
2987412 2987413 datum_gateway   ./datum_gateway
2987412 2987414 datum_gateway   ./datum_gateway
2987412 2987415 datum_gateway   ./datum_gateway
2987412 2987416 datum_gateway   ./datum_gateway
2987412 2987417 datum_gateway   ./datum_gateway
2987412 2987418 MHD-single      ./datum_gateway
2987412 2987419 datum_gateway   ./datum_gateway
2987412 2987420 datum_gateway   ./datum_gateway
2987412 2987421 datum_gateway   ./datum_gateway

AFTER:
ps -T -p 2993005 -o pid,tid,comm,args
    PID     TID COMMAND         COMMAND
2993005 2993005 datum_gateway   ./datum_gateway
2993005 2993006 logger          ./datum_gateway
2993005 2993007 api             ./datum_gateway
2993005 2993008 coinbaser       ./datum_gateway
2993005 2993009 template        ./datum_gateway
2993005 2993010 stratum         ./datum_gateway
2993005 2993011 MHD-single      ./datum_gateway
2993005 2993012 fallback        ./datum_gateway
2993005 2993013 submitblock     ./datum_gateway
2993005 2993014 listener        ./datum_gateway

Comment thread src/datum_utils.h Outdated
#include "datum_logger.h"

#ifdef HAVE_PTHREAD_SETNAME_NP
#define datum_set_thread_name(name) pthread_setname_np(pthread_self(), (name))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight preference for simply defining pthread_setname_np no-op when it's missing (and calling directly in the code)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

force-pushed a clean version taking this into account

@luke-jr luke-jr added this to the v0.5.0 milestone Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Threads are not named

2 participants