qthread_worker(3)

πŸ“¦ version 1.22^20251007gitcedb1fc, in fedora 43, fedora 44

πŸ’– qthread_worker β€” bestie edition πŸ’–

okay so this is a page from libqthread and it's literally the manual for qthread_worker, which tells you what worker ID your current thread is vibing on. short page, huge energy. let's get into it ✨


🌸 NAME 🌸

qthread_worker β€” returns the qthread's current worker ID 🫢


✨ SYNOPSIS ✨

#include <qthread.h>

qthread_worker_id_t
qthread_worker (qthread_shepherd_id_t *shep);

like, that's the whole thing. iconic honestly πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so qthread_worker hands you back the ID of the worker that the current thread is executing on. that's it, that's the job. main character behavior.

and here's the cute little bonus: if shep is non-NULL, then the value of the current shepherd identifier gets written to that location. so you can walk away with both pieces of info in one call. slay πŸŽ€

⚠️ okay important bestie, listen: the current worker ID is transient. like, it's likely to change. for example, after a call to qthread_yield(). do not get attached. do not store it in your diary. it's giving "you blinked and it's a different worker."

also, that value is dependent on how many workers are currently active. so the number you get depends on the current situation, not some fixed forever-number. iykyk πŸ”₯


πŸ‘‘ RETURN VALUE πŸ‘‘

this function either:

  • returns the ID number of the current worker of the calling function, or
  • returns NO_WORKER

that's the whole menu. either you get a worker ID or you get NO_WORKER, no in-between, no crumbs πŸ’€


🌈 SEE ALSO 🌈

go read those too, they're all part of the same little family 🧚


k byeeee, this page came from libqthread and it's dated JUNE 2011 β€” old but still absolutely serving. mwah πŸ’œπŸ’–βœ¨

πŸ“¦ where this page comes from