Can we set up software timer in openwrt?
Something other than sleep
or cron
or the various standard C calls?
Yes,
To get interrupt(callback function invoke) after a time period.
Standard C calls then. The library used by OpenWrt is musl in current versions. Though if you’re asking for what your words say, that should have been an obvious answer, so perhaps I misunderstood.
If not C, what are you trying to accomplish?
In RTOS (like freertos: https://www.freertos.org/FreeRTOS-Software-Timer-API-Functions.html) there will be timer modules. So we can create timer using API xTimerCreate(), and get interrupt using these timer module for a particular timeout. I am asking whether we have such modules in openWRT.
OpenWrt is a standard POSIX/Linux environment using musl
libc as C runtime, so all the usual Linux facilities exist.
Your question is way too unspecific to answer properly but assuming you want a timer mechanism in userspace, then the proper way to do so would be writing a custom daemon to invoke your logic whenever the desired timeouts expire.
You could use OpenWrt's libubox
library for convenience but many other choices, including plain C solely based on libc, exist.
Thank you so much.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.