This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zephyr k_poll and nrfxlib nrf_poll

Is there a way to trigger a work item on a nrfxlib socket event without a dedicated thread? Right now there is three polling mechanism in the SDK:

  • Zephyr k_poll(), which works for kernel synchronization primitives and can trigger k_work_poll-s
  • zsock_poll(), which works for zephyr sockets
  • nrf_poll(), which only works for nrfxlib BSD sockets

In our application there is an event loop that concurrently checks for signal from sensors or the network. I asked at Zephyr Slack if it's possible to trigger work items from sockets, and the answer was that zsock_poll() uses k_poll() internally via an undocumented private API. However, that's only true for Zephyr native stack sockets, polling offloaded sockets invokes nrf_poll() (via an ioctl). Is there a way to route nrf_socket events to k_poll()? If not, it would be nice to provide it in future versions (a quick and dirty solution would be a single callback to trigger a check of all nrf sockets).

Parents
  • Is there a way to route nrf_socket events to k_poll()? If not, it would be nice to provide it in future versions (a quick and dirty solution would be a single callback to trigger a check of all nrf sockets).

     Interesting question Valentin. Yes, it does not look like there is a proper way to route the nrf_sockets events to the k_poll to trigger a work item. It seems useful to have it.

Reply
  • Is there a way to route nrf_socket events to k_poll()? If not, it would be nice to provide it in future versions (a quick and dirty solution would be a single callback to trigger a check of all nrf sockets).

     Interesting question Valentin. Yes, it does not look like there is a proper way to route the nrf_sockets events to the k_poll to trigger a work item. It seems useful to have it.

Children
No Data
Related