[riot-users] Sock and timers

Joakim NohlgÄrd joakim.nohlgard at eistec.se
Tue Aug 28 16:23:27 CEST 2018


Hi RIOT users and developers,
Is there an easy way to combine a sock instance listening for incoming
UDP packets, with some timed events without making two separate
threads?
I have a process which needs to respond to incoming data over UDP, but
also perform some other tasks every x seconds. Are there any hooks for
using gnrc_sock_udp as part of an event loop?
Perhaps using thread_flags or some way of interrupting a blocking call
to sock_udp_recv (to make it return -EAGAIN)
Using sock_udp_recv with a timeout value of 0 lets the program poll
for incoming data, but without any thread flags or callbacks it will
take too much CPU budget to keep polling the recv function while
servicing other parts of the system.
I have used https://github.com/RIOT-OS/Tutorials/tree/master/task-06
as a starting point for my application but currently I am stuck on
implementing these timed events.

Best regards,
Joakim


More information about the users mailing list