hal_export_funct(3hal)
π hal_export_funct π
okay bestie, welcome to the hal_export_funct(3hal) page β yes that's the manual name, it lives in section 3hal, and it's literally the glow-up your realtime function needs to get noticed by the whole system β¨
β¨ NAME β¨
hal_export_funct β create a realtime function callable from a thread π§΅π
π SYNTAX π
typedef void(*hal_funct_t)(void * arg, long period)
int hal_export_funct(const char *name, hal_funct_t funct, void *arg, int
uses_fp, int reentrant, int comp_id)
that's the whole vibe, no cap π¦
πΈ ARGUMENTS πΈ
nameβ the name of the function. like, its name-name. what you're gonna call it πfunctβ the pointer to the function π«Άargβ the argument that gets passed as the first parameter offunctuses_fpβ nonzero if the function does floating-point operations, and yes that includes assigning floating point values with"="π don't skip that part, it countsreentrantβ ifreentrantis non-zero, the function may be preempted and called again before the first call even finishes π otherwise? it may only be added to one thread. one. single. thread. π«comp_idβ a HAL component identifier, and you get that from an earlier call tohal_initπ
π DESCRIPTION π
hal_export_funct makes a realtime function that a component provides available to the system. that's it, that's the whole serve π
then a later call to hal_add_funct_to_thread can be used to schedule when the function actually runs, as the system needs it.
so when this function gets placed on a HAL thread, and HAL threads are started, funct gets called over and over again with two arguments: void *arg is the exact same value you gave to hal_export_funct, and long period is the interval between calls, measured in nanoseconds β±οΈ
and listen β each call to the function should do a small amount of work and return. small. tiny. a lil snack, not a whole feast π
β RETURN VALUE β
Returns a HAL status code β¨
π₯ SEE ALSO π₯
and that's the page bestie π big shoutout to the LinuxCNC Documentation crew β this one's dated 2006-10-12, so it's been iconic for a minute π mwah, go schedule something π
π¦ where this page comes from
- debian bookworm: linuxcnc-uspace-dev 2.9.0~pre1+git20230208.f1270d6ed7-1+deb12u2 Β· GFDL-1.1-or-later
- 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