linux: use Mutex

Fixes #3807
This commit is contained in:
Alexander Boettcher 2020-07-07 11:41:44 +02:00 committed by Norman Feske
parent a0b0892df3
commit ce6f4dffe5
5 changed files with 11 additions and 13 deletions

View File

@ -43,8 +43,8 @@ namespace Genode {
struct Registry struct Registry
{ {
Lock _lock { }; Mutex _mutex { };
List<Platform_thread> _list { }; List<Platform_thread> _list { };
void insert(Platform_thread *thread); void insert(Platform_thread *thread);
void remove(Platform_thread *thread); void remove(Platform_thread *thread);

View File

@ -15,7 +15,6 @@
#define _CORE__INCLUDE__RPC_CAP_FACTORY_H_ #define _CORE__INCLUDE__RPC_CAP_FACTORY_H_
#include <base/allocator.h> #include <base/allocator.h>
#include <base/lock.h>
#include <base/capability.h> #include <base/capability.h>
namespace Genode { class Rpc_cap_factory; } namespace Genode { class Rpc_cap_factory; }

View File

@ -12,7 +12,6 @@
*/ */
/* Genode includes */ /* Genode includes */
#include <base/lock.h>
#include <linux_dataspace/client.h> #include <linux_dataspace/client.h>
/* base-internal includes */ /* base-internal includes */

View File

@ -32,21 +32,21 @@ typedef Token<Scanner_policy_identifier_with_underline> Tid_token;
void Platform_thread::Registry::insert(Platform_thread *thread) void Platform_thread::Registry::insert(Platform_thread *thread)
{ {
Lock::Guard guard(_lock); Mutex::Guard guard(_mutex);
_list.insert(thread); _list.insert(thread);
} }
void Platform_thread::Registry::remove(Platform_thread *thread) void Platform_thread::Registry::remove(Platform_thread *thread)
{ {
Lock::Guard guard(_lock); Mutex::Guard guard(_mutex);
_list.remove(thread); _list.remove(thread);
} }
void Platform_thread::Registry::submit_exception(unsigned long pid) void Platform_thread::Registry::submit_exception(unsigned long pid)
{ {
Lock::Guard guard(_lock); Mutex::Guard guard(_mutex);
/* traverse list to find 'Platform_thread' with matching PID */ /* traverse list to find 'Platform_thread' with matching PID */
for (Platform_thread *curr = _list.first(); curr; curr = curr->next()) { for (Platform_thread *curr = _list.first(); curr; curr = curr->next()) {

View File

@ -61,12 +61,12 @@ static bool is_sub_rm_session(Dataspace_capability ds)
/** /**
* Lock for protecting mmap/unmap sequences and region-map meta data * Mutex for protecting mmap/unmap sequences and region-map meta data
*/ */
static Lock &lock() static Mutex &mutex()
{ {
static Lock lock; static Mutex mutex { };
return lock; return mutex;
} }
@ -175,7 +175,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
Region_map::Local_addr local_addr, Region_map::Local_addr local_addr,
bool executable, bool writeable) bool executable, bool writeable)
{ {
Lock::Guard lock_guard(lock()); Mutex::Guard mutex_guard(mutex());
/* only support attach_at for sub RM sessions */ /* only support attach_at for sub RM sessions */
if (_sub_rm && !use_local_addr) { if (_sub_rm && !use_local_addr) {
@ -320,7 +320,7 @@ Region_map::Local_addr Region_map_mmap::attach(Dataspace_capability ds,
void Region_map_mmap::detach(Region_map::Local_addr local_addr) void Region_map_mmap::detach(Region_map::Local_addr local_addr)
{ {
Lock::Guard lock_guard(lock()); Mutex::Guard mutex_guard(mutex());
/* /*
* Cases * Cases