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

nRF9160 offloaded poll() is incompatible with other Zephyr file descriptors (e.g. eventfd)

The big advantage of using poll() in application is the possibility to listen for multiple events at once such as:

- incoming traffic on BSD socket,
- incoming traffic on other socket type (e.g. pipe, socketpair),
- some event from other application thread/component using eventfd(),
- some timeouts using timerfd (not implemented in Zephyr yet, but it seems just a matter of time).

Current implementation of offloaded poll() for nRF91 modem sockets uses nrf_poll() underneath. This means that only modem sockets (file descriptors) are handled using such poll() call (and most mechanisms mentioned above do not). This is enough only for some simple usage, but is very limiting when application requires some complex behavior based on other application threads or traffic from other network interfaces.

We need to have for example some callback based mechanism for getting notifications from nRF sockets. That way those notifications can be easily integrated with Zephyr native poll() mechanism, which handles all possible socket types and allows implementation of much more advanced application code and possibly integration with higher number of existing POSIX-compatible libraries.

Parents Reply Children
  • Hi,

    Thanks for forwarding this to developers!

    event_manager library is licenced with LicenseRef-Nordic-5-Clause, which means that such software could be running only on Nordic products. The library / SDK I am developing is about to target all Zephyr compatible platforms, which is why I want to use a generic mechanism like poll(). poll()/select()/epoll() are also standard Linux mechanisms, which make developers familiar with code that uses poll(). Right now I had to make a nRF91 specific workaround in the code I am developing, but this is a temporary solution. In the future this will result in non-negligible maintenance effort on our side and limit library/SDK functionalities working on nRF91 platform.

    Best regards,
    Marcin

  • I agree the ability to poll both NRF9160 modem-sockets and app-events concurrently through standard polling mechanisms would be very helpful!

Related