Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-11-02uloop: add support for user defined signal handlersJo-Philipp Wich
Reuse and extend the existing signal waker pipe mechanism to add user defined signal handling functionality to uloop. This commit introduces two new api functions `uloop_signal_add()` and `uloop_signal_remove()` along with a new structure type `uloop_signal` to allow adding and removing arbitrary signal handlers. Registered signal handlers are maintained in a linked list and matched by their signo member value which allows registering multiple handlers for the same signal numbers. Upon registering a new signal handler, the existing handler is saved in the `uloop_signal` structure. When removing the user defined signal handler, the original behavior is restored. The Lua binding has been updated as well to support the new signal handler mechanism. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-11-02uloop: add support for interval timersJo-Philipp Wich
So far, the only way to implement periodic interval timers was to use one-shot uloop_timeout timers which are rearmed within their completion callback immediately on expiration. While simple, this approach is not very precise and interval lengths will slowly drift over time, due to callback execution overhead, scheduling granularity etc. In order to make uloop provide stable and precise interval timer capabilities, this commit introduces a new `uloop_interval` structure along with the new related `uloop_interval_set()`, `uloop_interval_cancel()` and `uloop_interval_remaining()` api functions. Periodic timers are implemented using the timerfd facility an Linux and kqueue EVFILT_TIMER events on macOS/BSD. The Lua binding has been updated to include support for the new timer type as well. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-07-11examples/lua: attempt to highlight some trapsKarl Palsson
Ran into some issues with my fd event being garbage collected. As I never wanted to call :delete, I had seen no reason to keep the returned object, as my callback and upvalues were still valid. Signed-off-by: Karl Palsson <karlp@etactica.com>
2014-06-24Support delete a fd event.Xiongfei Guo
When you call the fd_add, it will return an object with `delete` method. So you can delete that event if you want. Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24Added fd_add method for uloop lua binding.Xiongfei Guo
Use uloop.fd_add like this: local socket = require "socket" udp = socket.udp() uloop.fd_add( udp, -- socket function( -- callback function ufd, -- socket object when register the fd events -- uloop events. eg. uloop.ULOOP_READ . ) local words, msg_or_ip, port_or_nil = ufd:receivefrom() print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : '..words) end, uloop.ULOOP_READ -- event you want to listen ) The `examples/uloop-example.lua` show an example of this work. Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2012-09-27add an example script for the uloop lua bindingFelix Fietkau