lwip: use Mutex

Issue #3801
This commit is contained in:
Alexander Boettcher 2020-07-06 10:42:54 +02:00 committed by Norman Feske
parent 6d653b3c0f
commit 7d1fd0b0a3
5 changed files with 12 additions and 13 deletions

View File

@ -20,7 +20,7 @@
namespace Lwip {
void genode_init(Genode::Allocator &heap, Genode::Timeout_scheduler &timer);
Genode::Lock &lock();
Genode::Mutex &mutex();
}
#endif

View File

@ -141,7 +141,7 @@ class Lwip::Nic_netif
void handle_rx_packets()
{
Genode::Lock::Guard g { Lwip::lock() };
Genode::Mutex::Guard guard { Lwip::mutex() };
auto &rx = *_nic.rx();
while (rx.packet_avail() && rx.ready_to_ack()) {

View File

@ -13,7 +13,6 @@
/* Genode includes */
#include <base/snprintf.h>
#include <base/lock.h>
#include <base/env.h>
extern "C" {

View File

@ -38,7 +38,7 @@ namespace Lwip {
{
void check_timeouts(Genode::Duration)
{
Genode::Lock::Guard g{ Lwip::lock() };
Genode::Mutex::Guard guard { Lwip::mutex() };
sys_check_timeouts();
}
@ -66,10 +66,10 @@ namespace Lwip {
lwip_init();
}
Genode::Lock &lock()
Genode::Mutex &mutex()
{
static Genode::Lock _lwip_lock;
return _lwip_lock;
static Genode::Mutex _lwip_mutex;
return _lwip_mutex;
}
}

View File

@ -902,7 +902,7 @@ class Lwip::Udp_socket_dir final :
char *dst, file_size count,
file_size &out_count) override
{
Genode::Lock::Guard g { Lwip::lock() };
Genode::Mutex::Guard guard { Lwip::mutex() };
Read_result result = Read_result::READ_ERR_INVALID;
switch(handle.kind) {
@ -988,7 +988,7 @@ class Lwip::Udp_socket_dir final :
char const *src, file_size count,
file_size &out_count) override
{
Genode::Lock::Guard g { Lwip::lock() };
Genode::Mutex::Guard g { Lwip::mutex() };
switch(handle.kind) {
@ -1291,7 +1291,7 @@ class Lwip::Tcp_socket_dir final :
char *dst, file_size count,
file_size &out_count) override
{
Genode::Lock::Guard g { Lwip::lock() };
Genode::Mutex::Guard g { Lwip::mutex() };
switch(handle.kind) {
@ -1377,9 +1377,9 @@ class Lwip::Tcp_socket_dir final :
handle.kind = Lwip_file_handle::LOCATION;
/* read the location of the new socket directory */
Lwip::lock().unlock();
Lwip::mutex().release();
Read_result result = handle.read(dst, count, out_count);
Lwip::lock().lock();
Lwip::mutex().acquire();
return result;
}
@ -1443,7 +1443,7 @@ class Lwip::Tcp_socket_dir final :
char const *src, file_size count,
file_size &out_count) override
{
Genode::Lock::Guard g { Lwip::lock() };
Genode::Mutex::Guard guard { Lwip::mutex() };
if (_pcb == NULL) {
/* socket is closed */
return Write_result::WRITE_ERR_IO;