rte_alarm.h(3)
π rte_alarm.h(3) β the alarm-clock page bestie π
okay so this is the manual page for rte_alarm.h, a header from DPDK, and it's literally just alarm stuff. no hpet required, no drama, just vibes and callbacks. let's get into it π
β¨ NAME β¨
rte_alarm.h β the header that gives you alarms. that's it, that's the name. short, sweet, icon behavior.
π SYNOPSIS πΈ
#include <stdint.h>
π¦ Typedefs
typedef void(* rte_eal_alarm_callback) (void *arg)β the callback type, aka the function signature your alarm calls when it goes off.
π«Ά Functions
int rte_eal_alarm_set (uint64_t us, rte_eal_alarm_callback cb, void *cb_arg)
int rte_eal_alarm_cancel (rte_eal_alarm_callback cb_fn, void *cb_arg)
π Detailed Description π
alarm functions!! π
this is the simple alarm-clock functionality supplied by eal. key detail: it does not require hpet support β so you're free, you're unbothered, you don't need that particular hardware feature. periodt.
Definition in file rte_alarm.h.
π Typedef Documentation π
β typedef void(* rte_eal_alarm_callback) (void *arg)
this is the signature of the callback function that gets called when an alarm goes off. like, that's the whole job. when the alarm pops, this is what runs. lowkey iconic.
Definition at line 26 of file rte_alarm.h.
π₯ Function Documentation π₯
π int rte_eal_alarm_set (uint64_t us, rte_eal_alarm_callback cb, void *cb_arg)
bestie this is the function that sets a callback to be triggered once us microseconds have expired. β°
important timing tea, so listen up: the accuracy of timing to the microsecond is not guaranteed. the alarm function will not be called before the requested time, but it may be called a short period of time afterwards. so don't come for it if it's a lil late, it was never gonna be early. π
also, the alarm handler will be called only once. one and done, no repeats.
and the nice part: there is no need to call "rte_eal_alarm_cancel" from within the callback function. so don't stress about cleanup in there.
πΈ Parameters
usβ The time in microseconds before the callback is calledcbβ The function to be called when the alarm expirescb_argβ Pointer parameter to be passed to the callback function
β¨ Returns
- On success, zero. On failure, a negative error number.
π int rte_eal_alarm_cancel (rte_eal_alarm_callback cb_fn, void * cb_arg)
this one cancels an alarm callback that has been registered before. say sike right now π
one lil note: if used outside alarm callback it waits for all callbacks to finish execution. so it's giving patient, but also it will sit there until everything's done. no cap.
π§ Parameters
cb_fnβ alarm callbackcb_argβ Pointer parameter to be passed to the callback function. To remove all copies of a given callback function, irrespective of parameter,(void *)-1can be used here. yes,(void *)-1, that's the magic wildcard bestie, write it exactly like that.
π Returns
okay this one has a whole menu of return situations, so pay attention, this is the main character energy part:
- value greater than 0 and
rte_errnonot changed β returned value is the number of canceled alarm callback functions - value greater or equal 0 and
rte_errnoset toEINPROGRESSβ at least one alarm could not be canceled because cancellation was requested from alarm callback context. Returned value is the number of successfully canceled alarm callbacks - 0 and
rte_errnoset toENOENTβ no alarm found - -1 and
rte_errnoset toEINVALβ invalid parameter (NULL callback)
π¨ not me reminding you that a NULL callback is a no-go and gets youEINVALwith a-1. read the return list, memorize the return list, live by the return list. fr fr.
π Author π
Generated automatically by Doxygen for DPDK from the source code. so nobody hand-wrote this lil cutie, the robot did it and honestly it ate. π€β¨
so yeah that's the whole page β alarm set, alarm cancel, one-shot callbacks, microseconds that are approximate-but-never-early, and a return-value lore drop at the end. you're basically a timing expert now, bestie, slay π¦
this was DPDK Version 25.11.3, page rte_alarm.h(3) β mwah, go forth and schedule responsibly π
πΈ
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms