qt_begin_blocking_action(3)
π qt_begin_blocking_action(3) π
okay bestie, welcome to the libqthread manual, page three of qt_begin_blocking_action β yes the whole thing, both functions, we're doing this together π«Ά
β¨ NAME β¨
qt_begin_blocking_action, qt_end_blocking_action β the little duo that tells the runtime "hey, this part is gonna block" π
β¨ SYNOPSIS β¨
#include <qthread/io.h>
void
qt_begin_blocking_action(void);
void
qt_end_blocking_action(void);
literally that's it, two void functions, no arguments, no return values, no drama πΈ
β¨ DESCRIPTION β¨
so here's the tea β β these two functions exist to isolate sections of code that may block and that aren't intercepted in some other way. super handy when you're trying to inter-operate with third-party libraries, because those libraries did NOT get the memo about your fancy runtime and they will absolutely just sit there and block. no cap.
here's what actually goes down when you call qt_begin_blocking_action():
- the task that calls it gets descheduled and enqueued in the system call queue π₯
- once it's in there, it gets treated exactly the same as anything else in that queue β same rules about the number of concurrent operations permitted, same relationship to the servicing threads. no special treatment, no main character energy here, it just queues up like everybody else π
- after calling
qt_begin_blocking_action(), the task wakes up in an external, dedicated thread π§ and that's where it can do the blocking operation β without any fear that doing so would hijack the original worker thread. iconic. that's the whole point. the worker thread stays safe and un-hijacked, periodt π
and once the blocking operation is done? you must call qt_end_blocking_action(). not "should", not "maybe later" β must. π that call is what reschedules the task in the standard scheduling queues, aka it puts your task back where it belongs. forget it and your task is just... out there. in the void. bestie please don't do that π
β¨ SEE ALSO β¨
if you liked this page you're gonna be obsessed with these π
qt_accept(3)qt_connect(3)qt_poll(3)qt_pread(3)qt_pwrite(3)qt_read(3)qt_select(3)qt_system(3)qt_wait4(3)qt_write(3)
and that's the whole page babes π this one's from libqthread, dated AUGUST 2012, and it's filed under qt_begin_blocking_action(3). go forth and block responsibly π
β¨π¦
π¦ 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