Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: sockets: services: Don't modify pollfd array from other threads
pollfd array used with zsock_poll() should not be modified while inside zsock_poll() function as this could lead to unexpected results. For instance, k_poll already monitoring some kernel primitive could report an event, but it will not be processed if the monitored socket file descriptor in the pollfd array was set to -1. In result, zsock_poll() may unexpectedly quit prematurely, returning 0 events, even if it was requested to wait infinitely. The pollfd arrays used by zsock_poll() (ctx.events) is reinitialized when the service thread is restarted so modifying it directly when registering/unregistering service is not really needed. It's enough if those functions notify the eventfd socket used to restart the services thread. Signed-off-by: Robert Lubos <[email protected]>
- Loading branch information