qthread_disable_worker(3)
π qthread_disable_worker β bestie edition π
okay so this is a page from the libqthread manual, and it's all about the qthread_disable_worker and qthread_enable_worker girlies. come sit with me, we're gonna go through it together π«Ά
β¨ NAME β¨
qthread_disable_worker, qthread_enable_worker β enable or disable a worker for thread scheduling
like literally the on/off switch for your workers, no cap π
πΈ SYNOPSIS πΈ
#include <qthread.h>
int
qthread_disable_worker (qthread_worker_id_t worker);
void
qthread_enable_worker (qthread_worker_id_t shep);
note bestie: yes, the second one takes shep, not worker. that's not me being quirky, that's the actual signature. we do not edit the source material π
π¦ DESCRIPTION π¦
so these two functions let you enable and disable worker threads. think of it as a vibe check you get to run on any worker you want β¨
workers usually start out in the enabled state β the one exception is when the QT_HWPAR environment variable is in play. so if you've set that, expect some of your workers to wake up already disabled, iykyk π
here's the tea on disabled workers:
- a disabled worker cannot execute threads, periodt.
- the presumption is that there are other workers on each shepherd, so the workload isn't just gonna sit there abandoned π
- the disabled worker may continue executing its current thread until it either blocks, yields, or exits. it's not a hard stop, it's a "finish your sentence then go sit down" situation.
- once that thread stops executing, the disabled worker just monitors its own status and waits β either to be destroyed or to be re-enabled. main character in the waiting room fr π
and when a worker gets re-enabled? it starts scheduling threads again. back on her bullshit, iconic, we love to see it π
π RETURN VALUE π
on success, the specified worker thread is marked as disabled and the value QTHREAD_SUCCESS is returned π
on failure, an error code is returned. so like, check it. don't just assume π€
β ERRORS β
QTHREAD_NOT_ALLOWEDβ the first worker, worker0, cannot be disabled.
bestie listen. worker 0 is not getting disabled. not today, not ever. don't even try it, the library will simply tell you no π
π a lil sign-off π
this page lives in the libqthread manual, and the version we're looking at is dated AUGUST 2012 β vintage, honestly, a real relic and still serving πβ¨
now go forth and toggle your workers responsibly, love u, bye ππ§
π¦ where this page comes from
- fedora 43: qthreads-devel 1.22^20251007gitcedb1fc-1.fc43 Β· BSD-3-Clause AND MIT AND dtoa
- fedora 44: qthreads-devel 1.22^20251007gitcedb1fc-2.fc44 Β· BSD-3-Clause AND MIT AND dtoa
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms