pc_wifi_drv: unblock pthread via signal

Since unblocking the pthread directly may lead to corruption we need
to post-pone it. So we send a signal that should be handled by the EP
after the EP has finished its current line of work.

Fixes #4523.
This commit is contained in:
Josef Söntgen 2022-06-03 16:15:44 +02:00 committed by Christian Helmuth
parent 9d383037e4
commit d3e53b3cca

View File

@ -237,6 +237,8 @@ class Lx::Socket
Genode::Signal_transmitter _sender { }; Genode::Signal_transmitter _sender { };
Genode::Signal_handler<Lx::Socket> _dispatcher; Genode::Signal_handler<Lx::Socket> _dispatcher;
Genode::Signal_handler<Lx::Socket> _dispatcher_blockade;
struct socket *_sock_poll_table[Wifi::MAX_POLL_SOCKETS] { }; struct socket *_sock_poll_table[Wifi::MAX_POLL_SOCKETS] { };
struct socket *_call_socket() struct socket *_call_socket()
@ -411,11 +413,17 @@ class Lx::Socket
Lx_kit::env().scheduler.schedule(); Lx_kit::env().scheduler.schedule();
} }
void _handle_blockade()
{
_block.up();
}
public: public:
Socket(Genode::Entrypoint &ep) Socket(Genode::Entrypoint &ep)
: :
_dispatcher(ep, *this, &Lx::Socket::_handle) _dispatcher(ep, *this, &Lx::Socket::_handle),
_dispatcher_blockade(ep, *this, &Lx::Socket::_handle_blockade)
{ {
_sender.context(_dispatcher); _sender.context(_dispatcher);
} }
@ -448,7 +456,7 @@ class Lx::Socket
_call.opcode = Call::NONE; _call.opcode = Call::NONE;
if (old != Call::NONE) { _block.up(); } if (old != Call::NONE) { _dispatcher_blockade.local_submit(); }
} }
void submit_and_block() void submit_and_block()