Closed mniestroj closed 1 year ago
Visit the preview URL for this PR (updated for commit 3ca1074):
https://golioth-zephyr-sdk-doxygen-dev--pr326-sock-offload-wra-rb405w07.web.app
(expires Wed, 14 Dec 2022 15:19:37 GMT)
🔥 via Firebase Hosting GitHub Action 🌎
Sign: a389eefadf4b4b68a539327b3459dd66c142cf49
So far there was a possibility that work item was in both RUNNING and QUEUED states. As a result of
zsock_close()
call, threaded (executed from workqueue)zsock_poll()
returned. However just because work was QUEUED,sock_wrapper_poll_handler()
was entered once again by workqueue thread. Subsequent work cancellation withk_work_cancel_sync()
could no longer be finished, as work was waiting once again onzsock_close()
.Start work cancellation using
k_work_cancel()
just beforezsock_close()
is invoked. This clears QUEUED state from work item, sosock_wrapper_poll_handler()
is not reentered. Afterzsock_close()
has returned, it is safe to callk_work_cancel_sync()
to finish work cancellation and make sure thatsock_wrapper_poll_handler()
(hencezsock_poll()
) is no longer running.