qthread_disable_worker(3)

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

πŸ’– 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, worker 0, 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