rtapi_task_new(3rtapi)

πŸ’– rtapi_task_new β€” the "make me a realtime task" girlie πŸ’–

okay so bestie, this is from the RTAPI corner of the manual, and it's literally about creating a realtime task. not starting it. creating it. we'll get there. 🫢


✨ NAME ✨

rtapi_task_new β€” create a realtime task πŸ’…


πŸŽ€ SYNTAX πŸŽ€

like, here's the whole vibe, copy it exactly bestie:

int rtapi_task_new(void (*taskcode)(void*), void *arg,      int prio,
       unsigned long stacksize, int uses_fp)

int rtapi_task_delete(int task_id)

🌸 ARGUMENTS 🌸

  • taskcode β€” a pointer to the function that gets called when the task is started. like, the main character function. πŸ‘‘
  • arg β€” an argument you pass along to the taskcode function when the task is started. little gift, wrapped up. 🎁
  • prio β€” a task priority value returned by rtapi_prio_xxxx. don't make one up, get it from the prio girlies.
  • uses_fp β€” a flag that tells the OS whether the task uses floating point or not. yes or no bestie, no in-between. πŸ¦‹
  • task_id β€” a task ID returned by a previous call to rtapi_task_new. it's the receipt from last time. 🧾

πŸ¦‹ DESCRIPTION πŸ¦‹

rtapi_task_new creates a realtime task but does not start it. no cap. it arrives in the "paused" state, just sitting there, minding its business. 😌

to actually get it going, you call one of these two:

  • rtapi_task_start β€” for periodic tasks
  • rtapi_task_resume β€” for free-running tasks

pick the right one for the right task, iykyk. πŸ’…


πŸ”₯ REALTIME CONSIDERATIONS πŸ”₯

call this only from within init/cleanup code. not from realtime tasks. periodt. πŸ™…β™€οΈ

⭐ RETURN VALUE ⭐

on success it hands you a positive integer task ID. this ID is what you use for all subsequent calls that need to act on the task β€” it's the task's whole identity bestie, remember it. πŸŽ€

on failure, it returns an RTAPI status code. 😭


🌈 SEE ALSO 🌈

go read those next, they're all part of the same friend group fr fr. πŸ’œ


and that's the page bestie!! ✨ this one's straight from the LinuxCNC Documentation, dated 2006-10-12, filed under rtapi_task_new(3rtapi). iconic, timeless, ate. πŸ‘‘πŸ’–