hal_add_funct_to_thread(3hal)
π hal_add_funct_to_thread β the 3hal page, but make it cute π
okay so bestie, this is hal_add_funct_to_thread(3hal) and it's genuinely one of the most iconic little calls in the whole HAL lineup. It's giving "put my function in a thread so it runs on a schedule" energy. Let's go. β¨
πΈ NAME πΈ
hal_add_funct_to_thread β cause a function to be executed at regular intervals
like... you hand it a function and a thread and it just. makes the function run on repeat. at regular intervals. no cap. π₯
π SYNTAX π
int hal_add_funct_to_thread(const char *funct_name, const char
*thread_name, int position)
int hal_del_funct_from_thread(const char *funct_name, const char
*thread_name)
two whole functions in one page, we love a double feature π«Ά
π ARGUMENTS π
funct_nameβ the name of the function. yeah. that one. the one you want in the thread. πthread_nameβ the name of the thread. the thread in question. the one you're adding it to. π§΅positionβ the desired location within the thread, bestie, and this is the spicy one. This determines when the function will run, in relation to the other functions already chilling in that thread. A positive number means the desired location is measured from the beginning of the thread, and a negative one is measured from the end. So:+1β this function becomes the first one to run π+5β it becomes the fifth one to run-2β it's next to last-1β it's last, the main character closing out the show π0β illegal. not "discouraged", not "a bit rude", ILLEGAL. Zero is illegal. π«
β¨ DESCRIPTION β¨
hal_add_funct_to_thread adds a function exported by a realtime HAL component to a realtime thread. That's it, that's the whole vibe β and it's the thing that determines how often and in what order functions get executed. So like, scheduling queen behavior. π
hal_del_funct_from_thread removes a function from a thread. bye bestie, we'll miss u π
β RETURN VALUE β
Returns a HAL status code. that's it, that's the whole sentence, periodt.
π REALTIME CONSIDERATIONS π
Call this only from realtime init code. Not from other realtime code, not from non-realtime code. like, only. just the init code. please. π
ok real talk, this one matters β if you call it from anywhere else, you're not in your lane, and realtime does not do second chances. init code only. π
π SEE ALSO π
hal_thread_new(3hal)hal_export_funct(3hal)
the whole squad, honestly π«Ά
mwah π that's the page! brought to you by the LinuxCNC Documentation, dated 2006-10-12, and filed forever under hal_add_funct_to_thread(3hal). go forth and thread responsibly β¨πΈ
π¦ where this page comes from
- debian trixie: linuxcnc-uspace-dev 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace-dev 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace-dev 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