THREADS(9)
π THREADS β the HAL Component one π
ok so this is the threads(9) page from the HAL Component section of the manual, and bestie, it's literally about making hard realtime threads happen. buckle up π
β¨ NAME β¨
threads β creates hard realtime HAL threads π§΅β¨
πΈ SYNOPSIS πΈ
loadrt threads name1=name period1=period [fp1=<0|1>] [<thread-2-info>]
[<thread-3-info>]
π DESCRIPTION π
so threads is the thing you use to create hard realtime threads that can run HAL functions at specific intervals. no cap, that's the whole job.
but here's the tea: it's not a true HAL component. like, at all. it doesn't export any functions, pins, or parameters of its own. not even one. π
once it's made one or more threads, those threads stand alone β they're independent, main character energy fr. so you can unload the threads component and it will not affect them whatsoever. and actually?? you can unload it and then reload it to create additional threads, as many times as you need. iconic behavior honestly π
so the deal is: threads can create up to three realtime threads. and they must be created in order, from fastest to slowest. important!! don't skip that.
each thread gets specified by three arguments:
name1β specifies the name of the first thread (thread 1). πΈperiod1β specifies the period of thread 1, in nanoseconds. β±οΈfp1β optional! specifies whether thread 1 will be used to execute floating point code. π
and listen: name and period are both required. no skipping. the third one, fp1, is the optional one.
if you don't specify fp1, it defaults to 1, which means the thread will support floating point. if you specify 0, you disable floating point support β and the perk is that it saves a small amount of execution time, because it doesn't have to save the FPU context. so like, a lil efficiency treat β¨
for additional threads? name2, period2, fp2, name3, period3, and fp3 all work exactly the same. same rules, same vibes.
and if you need more than three threads?? unload threads, then reload it to create more threads. that's the move. π«Ά
π¦ FUNCTIONS π¦
None π
π PINS π
None π
π PARAMETERS π
None π
π₯ BUGS π₯
ok so this is a fun one. the docs literally say that the existence of threads might be considered a bug. π
the reasoning: ideally, creating and deleting threads would be done directly with halcmd commands, like "newthread name period", "delthread name", or something similar.
but β and this is the catch β limitations in the current HAL implementation require thread creation to take place in kernel space, and loading a component is the most straightforward way to do that. so here we are. π§
and that's the whole page bestie!! it's giving short and sweet but deeply realtime β
no functions, no pins, no parameters, just threads. periodt. π
this lil manual page came from the LinuxCNC Documentation, and it's dated 2007-01-16. so yeah, it's been holding it down since 2007, still slaying. π«Ά
π¦ where this page comes from
- debian bookworm: linuxcnc-uspace 2.9.0~pre1+git20230208.f1270d6ed7-1+deb12u2 Β· GFDL-1.1-or-later
- debian trixie: linuxcnc-uspace 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms