Re: Closing an accepting BSD socket from a different thread
Thanks for the answer.
Paradigmatically correct approach to this situation is:Sure, no doubt on that. The problem is, that I need a mechanism to "unblock" the accept.
Yes, I could use non-blocking sockets with poll(), but I also found no easy to use mechanism to "unblock" poll(). I can't just send a signal to that thread which called poll() like it would work in Linux.
Eventually, we'll need to catch and fix such cases. But the onlyWill do.
Yeah sure, put this is polling and a waste of resources. That I really don't like, especially an small battery powered systems.My question is how I can safely "unblock" the thread waiting in theA way to not block forever in accept() call is to use timed poll() on
No, the only possible solution I see is an additional socket connection via localhost which "signals" poll() and afterwards I can see what needs to be done (e.g. calling close()).
The reason for my question is that I need to implement an event loop based system. I need events for sockets, timers, DNS.
The idea is to use e zephyr message queue with a thread reading from the queue and calling the callback functions.