core: use Mutex/Blockade

Issue #3612
This commit is contained in:
Alexander Boettcher 2020-02-18 15:29:47 +01:00 committed by Christian Helmuth
parent 85a1f91f59
commit e87d60ddf7
48 changed files with 218 additions and 232 deletions

View File

@ -82,7 +82,7 @@ void Irq_object::_wait_for_irq()
void Irq_object::start()
{
::Thread::start();
_sync_bootup.lock();
_sync_bootup.block();
}
@ -94,10 +94,10 @@ void Irq_object::entry()
}
/* thread is up and ready */
_sync_bootup.unlock();
_sync_bootup.wakeup();
/* wait for first ack_irq */
_sync_ack.lock();
_sync_ack.block();
while (true) {
@ -108,7 +108,7 @@ void Irq_object::entry()
Genode::Signal_transmitter(_sig_cap).submit(1);
_sync_ack.lock();
_sync_ack.block();
}
}
@ -116,7 +116,6 @@ void Irq_object::entry()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
_sync_ack(Lock::LOCKED), _sync_bootup(Lock::LOCKED),
_irq(irq)
{ }

View File

@ -17,7 +17,7 @@
/* Genode includes */
#include <base/allocator_avl.h>
#include <base/exception.h>
#include <base/lock.h>
#include <base/mutex.h>
#include <synced_range_allocator.h>
namespace Genode {
@ -35,7 +35,7 @@ namespace Genode {
Synced_range_allocator<Allocator_avl> _id_alloc;
Lock _lock { };
Mutex _mutex { };
public:

View File

@ -192,7 +192,7 @@ Cap_id_allocator::Cap_id_allocator(Allocator &alloc)
unsigned long Cap_id_allocator::alloc()
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
void *id = nullptr;
if (_id_alloc.alloc(CAP_ID_OFFSET, &id))
@ -203,7 +203,7 @@ unsigned long Cap_id_allocator::alloc()
void Cap_id_allocator::free(unsigned long id)
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
if (id < CAP_ID_RANGE)
_id_alloc.free((void*)(id & CAP_ID_MASK), CAP_ID_OFFSET);

View File

@ -227,14 +227,14 @@ struct Vcpu : Genode::Thread
State _state_request { NONE };
State _state_current { NONE };
Lock _remote_lock { Lock::UNLOCKED };
Mutex _remote_mutex { };
void entry() override
{
_wake_up.down();
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
/* leave scope for Thread::join() - vCPU setup failed */
if (_state_request == TERMINATE)
@ -319,7 +319,7 @@ struct Vcpu : Genode::Thread
while (true) {
/* read in requested state from remote threads */
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
_state_current = _state_request;
_state_request = NONE;
}
@ -331,7 +331,7 @@ struct Vcpu : Genode::Thread
if (_state_current != RUN && _state_current != PAUSE) {
Genode::error("unknown vcpu state ", (int)_state_current);
while (true) { _remote_lock.lock(); }
while (true) { _remote_mutex.acquire(); }
}
/* transfer vCPU state to Fiasco.OC */
@ -355,7 +355,7 @@ struct Vcpu : Genode::Thread
reason = 0xfc;
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
_state_request = NONE;
_state_current = PAUSE;
@ -380,7 +380,7 @@ struct Vcpu : Genode::Thread
reason = Fiasco::l4_vm_vmx_read_32(vmcs, Vmcs::EXI_REASON);
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
_state_request = NONE;
_state_current = PAUSE;
@ -1207,7 +1207,7 @@ struct Vcpu : Genode::Thread
void resume()
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
if (_state_request == RUN || _state_request == PAUSE)
return;
@ -1220,7 +1220,7 @@ struct Vcpu : Genode::Thread
void pause()
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
if (_state_request == PAUSE)
return;

View File

@ -49,7 +49,7 @@ bool Hw::Address_space::insert_translation(addr_t virt, addr_t phys,
try {
for (;;) {
try {
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
_tt.insert_translation(virt, phys, size, flags, _tt_alloc);
return true;
} catch(Hw::Out_of_tables &) {
@ -76,7 +76,7 @@ bool Hw::Address_space::lookup_translation(addr_t const virt, addr_t & phys)
void Hw::Address_space::flush(addr_t virt, size_t size, Core_local_addr)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
try {
_tt.remove_translation(virt, size, _tt_alloc);

View File

@ -72,7 +72,7 @@ class Hw::Address_space : public Genode::Address_space
using Table = Hw::Page_table;
using Array = Table::Allocator::Array<DEFAULT_TRANSLATION_TABLE_MAX>;
Genode::Lock _lock { }; /* table lock */
Genode::Mutex _mutex { }; /* table lock */
Table & _tt; /* table virt addr */
Genode::addr_t _tt_phys; /* table phys addr */
Array * _tt_array = nullptr;

View File

@ -17,7 +17,7 @@
/* Genode includes */
#include <util/list.h>
#include <util/construct_at.h>
#include <base/lock.h>
#include <base/mutex.h>
#include <base/tslab.h>
#include <base/capability.h>
#include <base/log.h>
@ -58,7 +58,7 @@ class Genode::Rpc_cap_factory
uint8_t _initial_slab_block[get_page_size()];
Slab _slab;
List<Kobject> _list { };
Lock _lock { };
Mutex _mutex { };
public:
@ -69,7 +69,7 @@ class Genode::Rpc_cap_factory
~Rpc_cap_factory()
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
while (Kobject * obj = _list.first()) {
_list.remove(obj);
@ -84,7 +84,7 @@ class Genode::Rpc_cap_factory
*/
Native_capability alloc(Native_capability ep)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
/* allocate kernel object */
Kobject * obj;
@ -106,7 +106,7 @@ class Genode::Rpc_cap_factory
void free(Native_capability cap)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
for (Kobject * obj = _list.first(); obj; obj = obj->next()) {
if (obj->cap.data() == cap.data()) {

View File

@ -27,8 +27,8 @@ class Genode::Irq_object : public Thread_deprecated<4096>
private:
Genode::Signal_context_capability _sig_cap;
Genode::Lock _sync_ack;
Genode::Lock _sync_bootup;
Genode::Blockade _sync_ack { };
Genode::Blockade _sync_bootup { };
unsigned const _irq;
int _fd;

View File

@ -45,8 +45,6 @@ Genode::Irq_session::Info Genode::Irq_session_component::info()
Genode::Irq_object::Irq_object(unsigned irq) :
Thread_deprecated<4096>("irq"),
_sig_cap(Signal_context_capability()),
_sync_ack(Lock::LOCKED),
_sync_bootup(Lock::LOCKED),
_irq(irq),
_fd(-1)
{

View File

@ -53,8 +53,6 @@ Genode::Irq_session::Info Genode::Irq_session_component::info()
Genode::Irq_object::Irq_object(unsigned irq) :
Thread_deprecated<4096>("irq"),
_sig_cap(Signal_context_capability()),
_sync_ack(Lock::LOCKED),
_sync_bootup(Lock::LOCKED),
_irq(irq),
_fd(-1)
{ }
@ -82,8 +80,8 @@ void Genode::Irq_object::entry()
error("failed to register IRQ ", _irq);
}
_sync_bootup.unlock();
_sync_ack.lock();
_sync_bootup.wakeup();
_sync_ack.block();
while (true) {
@ -97,19 +95,19 @@ void Genode::Irq_object::entry()
Genode::Signal_transmitter(_sig_cap).submit(1);
_sync_ack.lock();
_sync_ack.block();
}
}
void Genode::Irq_object::ack_irq()
{
_sync_ack.unlock();
_sync_ack.wakeup();
}
void Genode::Irq_object::start()
{
Genode::Thread::start();
_sync_bootup.lock();
_sync_bootup.block();
}
void Genode::Irq_object::sigh(Signal_context_capability cap)

View File

@ -36,10 +36,10 @@ extern int main_thread_futex_counter;
static void empty_signal_handler(int) { }
static Lock &startup_lock()
static Blockade &startup_lock()
{
static Lock lock(Lock::LOCKED);
return lock;
static Blockade blockade;
return blockade;
}
@ -75,7 +75,7 @@ void Thread::_thread_start()
}
/* wakeup 'start' function */
startup_lock().unlock();
startup_lock().wakeup();
thread->entry();
@ -140,8 +140,8 @@ void Thread::_deinit_platform_thread()
void Thread::start()
{
/* synchronize calls of the 'start' function */
static Lock lock;
Lock::Guard guard(lock);
static Mutex mutex;
Mutex::Guard guard(mutex);
_init_cpu_session_and_trace_control();
@ -161,7 +161,7 @@ void Thread::start()
native_thread().pid = lx_getpid();
/* wait until the 'thread_start' function got entered */
startup_lock().lock();
startup_lock().block();
}

View File

@ -250,26 +250,21 @@ namespace Genode {
{
private:
/**
* Lock with the initial state set to LOCKED
*/
struct Barrier : Lock { Barrier() : Lock(Lock::LOCKED) { } };
/**
* Used to block the constructor until the new thread has initialized
* 'id'
*/
Barrier _construct_lock { };
Blockade _construct_lock { };
/**
* Used to block the new thread until 'start' is called
*/
Barrier _start_lock { };
Blockade _start_lock { };
/**
* Used to block the 'join()' function until the 'entry()' is done
*/
Barrier _join_lock { };
Blockade _join_lock { };
public:
@ -278,32 +273,32 @@ namespace Genode {
void wait_for_construction() override
{
_construct_lock.lock();
_construct_lock.block();
}
void constructed() override
{
_construct_lock.unlock();
_construct_lock.wakeup();
}
void wait_for_start() override
{
_start_lock.lock();
_start_lock.block();
}
void started() override
{
_start_lock.unlock();
_start_lock.wakeup();
}
void wait_for_join() override
{
_join_lock.lock();
_join_lock.block();
}
void joined() override
{
_join_lock.unlock();
_join_lock.wakeup();
}
};

View File

@ -19,9 +19,9 @@ enum { STACK_SIZE = 4096 };
struct Thread : Genode::Thread_deprecated<STACK_SIZE>
{
Genode::Lock &_barrier;
Genode::Blockade &_barrier;
Thread(Genode::Lock &barrier)
Thread(Genode::Blockade &barrier)
: Genode::Thread_deprecated<STACK_SIZE>("stat"), _barrier(barrier) { start(); }
void entry() override
@ -37,7 +37,7 @@ struct Thread : Genode::Thread_deprecated<STACK_SIZE>
/*
* Let main thread procees
*/
_barrier.unlock();
_barrier.wakeup();
}
};
@ -55,7 +55,7 @@ void Component::construct(Genode::Env &env)
{
Genode::log("--- thread-local errno test ---");
static Genode::Lock barrier(Genode::Lock::LOCKED);
static Genode::Blockade barrier;
int const orig_errno = errno;
@ -65,7 +65,7 @@ void Component::construct(Genode::Env &env)
static Thread thread(barrier);
/* block until the thread performed a 'stat' syscall */
barrier.lock();
barrier.block();
Genode::log("main: after thread completed, errno=", errno);

View File

@ -24,9 +24,9 @@
static Genode::Lock *main_wait_lock()
static Genode::Blockade *main_wait_lock()
{
static Genode::Lock inst(Genode::Lock::LOCKED);
static Genode::Blockade inst;
return &inst;
}
@ -46,7 +46,7 @@ static void *pthread_entry(void *)
Genode::log("second message");
main_wait_lock()->unlock();
main_wait_lock()->wakeup();
return 0;
}
@ -67,7 +67,7 @@ void Component::construct(Genode::Env &env)
pthread_create(&pth, 0, pthread_entry, 0);
/* wait until 'pthread_entry' finished */
main_wait_lock()->lock();
main_wait_lock()->block();
Genode::log("--- finished pthread IPC test ---");
exit_status = 0;

View File

@ -28,7 +28,7 @@ inline int lx_gettimeofday(struct timeval *tv, struct timeval *tz) {
Microseconds Timer::Time_source::max_timeout() const
{
Lock::Guard lock_guard(_lock);
Mutex::Guard mutex_guard(_mutex);
return Microseconds(1000 * 1000);
}

View File

@ -21,7 +21,7 @@
/* Genode includes */
#include <base/stdint.h>
#include <base/lock.h>
#include <base/mutex.h>
#include <util/avl_tree.h>
#include <util/noncopyable.h>
@ -32,12 +32,12 @@ namespace Genode {
private:
Lock _lock { };
Mutex _mutex { };
addr_t _base = 0;
addr_t _last = 0;
enum {
HEADER = sizeof(_base) + sizeof(_lock) + sizeof(_last),
HEADER = sizeof(_base) + sizeof(_mutex) + sizeof(_last),
CAP_RANGE_SIZE = 4096,
WORDS = (CAP_RANGE_SIZE - HEADER - sizeof(Avl_node<Cap_range>)) / sizeof(addr_t),
};

View File

@ -78,7 +78,7 @@ namespace Genode {
addr_t _initial_eip = 0;
addr_t _client_exc_pt_sel;
Lock _state_lock { };
Mutex _state_lock { };
struct
{
@ -230,7 +230,7 @@ namespace Genode {
*/
bool copy_thread_state(Thread_state * state_dst)
{
Lock::Guard _state_lock_guard(_state_lock);
Mutex::Guard _state_lock_guard(_state_lock);
if (!state_dst || !_state.blocked())
return false;
@ -245,7 +245,7 @@ namespace Genode {
*/
bool copy_thread_state(Thread_state state_src)
{
Lock::Guard _state_lock_guard(_state_lock);
Mutex::Guard _state_lock_guard(_state_lock);
if (!_state.blocked())
return false;
@ -267,12 +267,12 @@ namespace Genode {
inline void single_step(bool on)
{
_state_lock.lock();
_state_lock.acquire();
if (_state.is_dead() || !_state.blocked() ||
(on && (_state._status & _state.SINGLESTEP)) ||
(!on && !(_state._status & _state.SINGLESTEP))) {
_state_lock.unlock();
_state_lock.release();
return;
}
@ -281,7 +281,7 @@ namespace Genode {
else
_state._status &= ~_state.SINGLESTEP;
_state_lock.unlock();
_state_lock.release();
/* force client in exit and thereby apply single_step change */
client_recall(false);

View File

@ -16,7 +16,7 @@
/* Genode includes */
#include <util/list.h>
#include <base/lock.h>
#include <base/mutex.h>
#include <base/capability.h>
#include <base/tslab.h>
#include <base/log.h>
@ -40,7 +40,7 @@ class Genode::Rpc_cap_factory
Tslab<Cap_object, SBS> _slab;
List<Cap_object> _list { };
Lock _lock { };
Mutex _mutex { };
public:

View File

@ -138,7 +138,7 @@ void Pager_object::_page_fault_handler(Pager_object &obj)
* handler thread which may respond via wake_up() (ep thread) before
* we are done here - we have to lock the whole page lookup procedure
*/
obj._state_lock.lock();
obj._state_lock.acquire();
obj._state.thread.ip = ipc_pager.fault_ip();
obj._state.thread.sp = 0;
@ -164,7 +164,7 @@ void Pager_object::_page_fault_handler(Pager_object &obj)
if (res == Nova::NOVA_PD_OOM) {
obj._state.unblock_pause_sm();
obj._state.unblock();
obj._state_lock.unlock();
obj._state_lock.release();
/* block until revoke is due */
ipc_pager.reply_and_wait_for_fault(obj.sel_sm_block_oom());
@ -178,7 +178,7 @@ void Pager_object::_page_fault_handler(Pager_object &obj)
if (!error) {
obj._state.unblock_pause_sm();
obj._state.unblock();
obj._state_lock.unlock();
obj._state_lock.release();
ipc_pager.reply_and_wait_for_fault();
}
@ -196,7 +196,7 @@ void Pager_object::_page_fault_handler(Pager_object &obj)
/* region manager fault - to be handled */
log("page fault, ", fault_info, " reason=", error);
obj._state_lock.unlock();
obj._state_lock.release();
/* block the faulting thread until region manager is done */
ipc_pager.reply_and_wait_for_fault(obj.sel_sm_block_pause());
@ -218,7 +218,7 @@ void Pager_object::exception(uint8_t exit_id)
uint8_t res = 0xFF;
addr_t mtd = 0;
_state_lock.lock();
_state_lock.acquire();
/* remember exception type for Cpu_session::state() calls */
_state.thread.trapno = exit_id;
@ -254,7 +254,7 @@ void Pager_object::exception(uint8_t exit_id)
}
}
_state_lock.unlock();
_state_lock.release();
utcb.set_msg_word(0);
utcb.mtd = mtd;
@ -268,7 +268,7 @@ void Pager_object::_recall_handler(Pager_object &obj)
Thread &myself = *Thread::myself();
Utcb &utcb = *reinterpret_cast<Utcb *>(myself.utcb());
obj._state_lock.lock();
obj._state_lock.acquire();
if (obj._state.modified) {
obj._copy_state_to_utcb(utcb);
@ -299,7 +299,7 @@ void Pager_object::_recall_handler(Pager_object &obj)
obj._state.block_pause_sm();
}
obj._state_lock.unlock();
obj._state_lock.release();
utcb.set_msg_word(0);
reply(myself.stack_top(), sm);
@ -429,7 +429,7 @@ void Pager_object::_invoke_handler(Pager_object &obj)
void Pager_object::wake_up()
{
Lock::Guard _state_lock_guard(_state_lock);
Mutex::Guard _state_lock_guard(_state_lock);
if (!_state.blocked())
return;
@ -467,7 +467,7 @@ void Pager_object::client_cancel_blocking()
uint8_t Pager_object::client_recall(bool get_state_and_block)
{
Lock::Guard _state_lock_guard(_state_lock);
Mutex::Guard _state_lock_guard(_state_lock);
return _unsynchronized_client_recall(get_state_and_block);
}

View File

@ -29,7 +29,7 @@ Native_capability Rpc_cap_factory::alloc(Native_capability ep, addr_t entry, add
using namespace Nova;
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
/* create cap object */
Cap_object * pt_cap = new (&_slab) Cap_object(pt_sel);
@ -64,7 +64,7 @@ void Rpc_cap_factory::free(Native_capability cap)
{
if (!cap.valid()) return;
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
for (Cap_object *obj = _list.first(); obj ; obj = obj->next()) {
if (cap.local_name() == (long)obj->_cap_sel) {
@ -86,7 +86,7 @@ Rpc_cap_factory::Rpc_cap_factory(Allocator &md_alloc)
Rpc_cap_factory::~Rpc_cap_factory()
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
for (Cap_object *obj; (obj = _list.first()); ) {
Nova::revoke(Nova::Obj_crd(obj->_cap_sel, 0));

View File

@ -46,7 +46,7 @@ void Cap_range::inc(unsigned id)
{
bool failure = false;
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
if (_cap_array[id] + 1 == 0)
failure = true;
@ -65,7 +65,7 @@ void Cap_range::dec(unsigned const id_start, bool revoke, unsigned num_log_2)
{
unsigned const end = min(id_start + (1U << num_log_2), elements());
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
for (unsigned id = id_start; id < end; id++) {
if (_cap_array[id] == 0) {
@ -92,7 +92,7 @@ addr_t Cap_range::alloc(size_t const num_log2)
addr_t const step = 1UL << num_log2;
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
unsigned max = elements();
addr_t last = _last;

View File

@ -83,7 +83,7 @@ void Irq_object::_wait_for_irq()
void Irq_object::start()
{
::Thread::start();
_sync_bootup.lock();
_sync_bootup.block();
}
@ -93,10 +93,10 @@ void Irq_object::entry()
error("could not associate with IRQ ", Hex(_irq));
/* thread is up and ready */
_sync_bootup.unlock();
_sync_bootup.wakeup();
/* wait for first ack_irq */
_sync_ack.lock();
_sync_ack.block();
while (true) {
@ -110,7 +110,7 @@ void Irq_object::entry()
Genode::Signal_transmitter(_sig_cap).submit(1);
_sync_ack.lock();
_sync_ack.block();
}
}
@ -118,7 +118,6 @@ void Irq_object::entry()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
_sync_ack(Lock::LOCKED), _sync_bootup(Lock::LOCKED),
_irq(irq)
{ }

View File

@ -61,7 +61,7 @@ void Irq_object::_wait_for_irq()
void Irq_object::start()
{
::Thread::start();
_sync_bootup.lock();
_sync_bootup.block();
}
@ -73,10 +73,10 @@ void Irq_object::entry()
}
/* thread is up and ready */
_sync_bootup.unlock();
_sync_bootup.wakeup();
/* wait for first ack_irq */
_sync_ack.lock();
_sync_ack.block();
/*
* Right after associating with an interrupt, the interrupt is
@ -96,7 +96,7 @@ void Irq_object::entry()
*/
if (_sig_cap.valid()) {
Genode::Signal_transmitter(_sig_cap).submit(1);
_sync_ack.lock();
_sync_ack.block();
}
while (true) {
@ -108,7 +108,7 @@ void Irq_object::entry()
Genode::Signal_transmitter(_sig_cap).submit(1);
_sync_ack.lock();
_sync_ack.block();
}
}
@ -116,7 +116,6 @@ void Irq_object::entry()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
_sync_ack(Lock::LOCKED), _sync_bootup(Lock::LOCKED),
_irq(irq)
{ }

View File

@ -25,7 +25,7 @@ class Genode::Irq_object : public Thread_deprecated<4096> {
private:
Signal_context_capability _sig_cap { };
Lock _sync_bootup;
Blockade _sync_bootup { };
unsigned _irq;
Cap_sel _kernel_irq_sel;
Cap_sel _kernel_notify_sel;

View File

@ -164,13 +164,13 @@ class Genode::Platform : public Platform_generic
struct Core_sel_alloc : Cap_sel_alloc, private Core_sel_bit_alloc
{
Lock _lock { };
Mutex _mutex { };
Core_sel_alloc() { _reserve(0, Core_cspace::core_static_sel_end()); }
Cap_sel alloc() override
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
try {
return Cap_sel(Core_sel_bit_alloc::alloc()); }
@ -180,7 +180,7 @@ class Genode::Platform : public Platform_generic
void free(Cap_sel sel) override
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
Core_sel_bit_alloc::free(sel.value());
}

View File

@ -58,7 +58,7 @@ class Genode::Platform_pd : public Address_space
};
Sel_alloc _sel_alloc { };
Lock _sel_alloc_lock { };
Mutex _sel_alloc_mutex { };
Cap_sel alloc_sel();
void free_sel(Cap_sel sel);

View File

@ -156,7 +156,7 @@ class Genode::Vm_space
return Cnode_index(idx & (LEAF_CNODE_SIZE - 1));
}
Lock _lock { };
Mutex _mutex { };
/**
* Return selector for a capability slot within '_vm_cnodes'
@ -406,7 +406,7 @@ class Genode::Vm_space
return true;
};
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
bool ok = true;
@ -445,7 +445,7 @@ class Genode::Vm_space
return true;
};
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
for (size_t i = 0; i < num_pages; i++) {
off_t const offset = i << get_page_size_log2();
@ -462,7 +462,7 @@ class Genode::Vm_space
{
bool unmap_success = true;
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
for (size_t i = 0; unmap_success && i < num_pages; i++) {
off_t const offset = i << get_page_size_log2();
@ -499,13 +499,13 @@ class Genode::Vm_space
void alloc_page_tables(addr_t const start, addr_t const size)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
unsynchronized_alloc_page_tables(start, size);
}
void alloc_guest_page_tables(addr_t const start, addr_t const size)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
unsynchronized_alloc_guest_page_tables(start, size);
}

View File

@ -62,14 +62,14 @@ void Irq_object::_wait_for_irq()
void Irq_object::start()
{
::Thread::start();
_sync_bootup.lock();
_sync_bootup.block();
}
void Irq_object::entry()
{
/* thread is up and ready */
_sync_bootup.unlock();
_sync_bootup.wakeup();
while (true) {
@ -92,7 +92,6 @@ void Irq_object::ack_irq()
Irq_object::Irq_object(unsigned irq)
:
Thread_deprecated<4096>("irq"),
_sync_bootup(Lock::LOCKED),
_irq(irq),
_kernel_irq_sel(platform_specific().core_sel_alloc().alloc()),
_kernel_notify_sel(platform_specific().core_sel_alloc().alloc())

View File

@ -142,7 +142,7 @@ void Platform_pd::assign_parent(Native_capability parent)
Cap_sel Platform_pd::alloc_sel()
{
Lock::Guard guard(_sel_alloc_lock);
Mutex::Guard guard(_sel_alloc_mutex);
return Cap_sel(_sel_alloc.alloc());
}
@ -150,7 +150,7 @@ Cap_sel Platform_pd::alloc_sel()
void Platform_pd::free_sel(Cap_sel sel)
{
Lock::Guard guard(_sel_alloc_lock);
Mutex::Guard guard(_sel_alloc_mutex);
_sel_alloc.free(sel.value());
}

View File

@ -38,19 +38,19 @@ class Platform_thread_registry : Noncopyable
private:
List<Platform_thread> _threads { };
Lock _lock { };
Mutex _mutex { };
public:
void insert(Platform_thread &thread)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
_threads.insert(&thread);
}
void remove(Platform_thread &thread)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
_threads.remove(&thread);
}
@ -59,7 +59,7 @@ class Platform_thread_registry : Noncopyable
unsigned installed = 0;
bool result = true;
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
for (Platform_thread *t = _threads.first(); t; t = t->next()) {
if (t->pager_object_badge() == pager_object_badge) {

View File

@ -15,8 +15,8 @@
#define _INCLUDE__BASE__INTERNAL__CAPABILITY_SPACE_SEL4_H_
/* base includes */
#include <base/mutex.h>
#include <util/avl_tree.h>
#include <base/lock.h>
#include <util/construct_at.h>
/* base-internal includes */
@ -171,7 +171,7 @@ class Genode::Capability_space_sel4
Tree_managed_data _caps_data[NUM_CAPS];
Avl_tree<Tree_managed_data> _tree { };
Lock mutable _lock { };
Mutex mutable _mutex { };
/**
* Calculate index into _caps_data for capability data object
@ -218,7 +218,7 @@ class Genode::Capability_space_sel4
ASSERT(sel < NUM_CAPS);
ASSERT(!_caps_data[sel].rpc_obj_key().valid());
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
construct_at<Tree_managed_data>(&_caps_data[sel], args...);
@ -240,7 +240,7 @@ class Genode::Capability_space_sel4
void dec_ref(Data &data)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
if (!_is_core_managed(data) && !data.dec_ref())
_remove(data);
@ -248,7 +248,7 @@ class Genode::Capability_space_sel4
void inc_ref(Data &data)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
if (!_is_core_managed(data)) {
data.inc_ref();
@ -272,7 +272,7 @@ class Genode::Capability_space_sel4
Data *lookup(Rpc_obj_key key) const
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
if (!_tree.first())
return nullptr;

View File

@ -62,7 +62,7 @@ namespace {
{
private:
Lock _lock { };
Mutex _mutex { };
public:
@ -70,13 +70,13 @@ namespace {
unsigned alloc()
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
return Bit_allocator::alloc();
}
void free(unsigned sel)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
Bit_allocator::free(sel);
}
};

View File

@ -41,7 +41,7 @@ struct Vcpu : Genode::Thread
Semaphore _wake_up { 0 };
Semaphore &_handler_ready;
Allocator &_alloc;
Lock _startup { Genode::Lock::LOCKED };
Blockade _startup { };
Vm_session_client::Vcpu_id _id {};
addr_t _state { 0 };
addr_t _recall { 0 };
@ -62,7 +62,7 @@ struct Vcpu : Genode::Thread
PAUSE = 1,
RUN = 2
} _remote { NONE };
Lock _remote_lock { Lock::UNLOCKED };
Mutex _remote_mutex { };
enum {
VMEXIT_INVALID = 0x21,
@ -91,7 +91,7 @@ struct Vcpu : Genode::Thread
void entry() override
{
/* trigger that thread is up */
_startup.unlock();
_startup.wakeup();
/* wait until vcpu is assigned to us */
_wake_up.down();
@ -108,7 +108,7 @@ struct Vcpu : Genode::Thread
_wake_up.down();
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
_remote = NONE;
}
@ -129,7 +129,7 @@ struct Vcpu : Genode::Thread
while (true) {
/* read in requested state from remote threads */
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
local_state = _remote;
_remote = NONE;
@ -173,7 +173,7 @@ struct Vcpu : Genode::Thread
if (local_state != RUN) {
Genode::error("unknown vcpu state ", (int)local_state);
while (true) { _remote_lock.lock(); }
while (true) { _remote_mutex.acquire(); }
}
_write_sel4_state(service, state);
@ -195,7 +195,7 @@ struct Vcpu : Genode::Thread
_read_sel4_state(service, state);
if (res != SEL4_VMENTER_RESULT_FAULT) {
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
if (_remote == PAUSE) {
_remote = NONE;
_wake_up.down();
@ -724,7 +724,7 @@ struct Vcpu : Genode::Thread
void start() override {
Thread::start();
_startup.lock();
_startup.block();
}
Genode::Vm_session_client::Vcpu_id id() const { return _id; }
@ -740,7 +740,7 @@ struct Vcpu : Genode::Thread
void resume()
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
if (_remote == RUN || _remote == PAUSE)
return;
@ -751,7 +751,7 @@ struct Vcpu : Genode::Thread
void pause()
{
Lock::Guard guard(_remote_lock);
Mutex::Guard guard(_remote_mutex);
if (_remote == PAUSE)
return;

View File

@ -49,7 +49,7 @@ Thread_capability Cpu_session_component::create_thread(Capability<Pd_session> pd
weight = Weight(QUOTA_LIMIT);
}
Lock::Guard thread_list_lock_guard(_thread_list_lock);
Mutex::Guard thread_list_lock_guard(_thread_list_lock);
/*
* Create thread associated with its protection domain
@ -60,7 +60,7 @@ Thread_capability Cpu_session_component::create_thread(Capability<Pd_session> pd
throw Thread_creation_failed();
}
Lock::Guard slab_lock_guard(_thread_alloc_lock);
Mutex::Guard slab_lock_guard(_thread_alloc_lock);
thread = new (&_thread_alloc)
Cpu_thread_component(
cap(), _thread_ep, _pager_ep, *pd, _trace_control_area,
@ -122,7 +122,7 @@ void Cpu_session_component::_unsynchronized_kill_thread(Thread_capability thread
_decr_weight(thread->weight());
{
Lock::Guard lock_guard(_thread_alloc_lock);
Mutex::Guard lock_guard(_thread_alloc_lock);
destroy(&_thread_alloc, thread);
}
@ -135,7 +135,7 @@ void Cpu_session_component::kill_thread(Thread_capability thread_cap)
if (!thread_cap.valid())
return;
Lock::Guard lock_guard(_thread_list_lock);
Mutex::Guard lock_guard(_thread_list_lock);
/* check that cap belongs to this session */
for (Cpu_thread_component *t = _thread_list.first(); t; t = t->next()) {
@ -151,7 +151,7 @@ void Cpu_session_component::exception_sigh(Signal_context_capability sigh)
{
_exception_sigh = sigh;
Lock::Guard lock_guard(_thread_list_lock);
Mutex::Guard lock_guard(_thread_list_lock);
for (Cpu_thread_component *t = _thread_list.first(); t; t = t->next())
t->session_exception_sigh(_exception_sigh);
@ -300,7 +300,7 @@ void Cpu_session_component::_deinit_ref_account()
{
/* rewire child ref accounts to this sessions's ref account */
{
Lock::Guard lock_guard(_ref_members_lock);
Mutex::Guard lock_guard(_ref_members_lock);
for (Cpu_session_component * s; (s = _ref_members.first()); ) {
_unsync_remove_ref_member(*s);
if (_ref)
@ -320,7 +320,7 @@ void Cpu_session_component::_deinit_ref_account()
void Cpu_session_component::_deinit_threads()
{
Lock::Guard lock_guard(_thread_list_lock);
Mutex::Guard lock_guard(_thread_list_lock);
/*
* We have to keep the '_thread_list_lock' during the whole destructor to
@ -356,7 +356,7 @@ void Cpu_session_component::_decr_weight(size_t const weight)
void Cpu_session_component::_decr_quota(size_t const quota)
{
Lock::Guard lock_guard(_thread_list_lock);
Mutex::Guard lock_guard(_thread_list_lock);
_quota -= quota;
_update_each_thread_quota();
}
@ -364,7 +364,7 @@ void Cpu_session_component::_decr_quota(size_t const quota)
void Cpu_session_component::_incr_quota(size_t const quota)
{
Lock::Guard lock_guard(_thread_list_lock);
Mutex::Guard lock_guard(_thread_list_lock);
_quota += quota;
_update_each_thread_quota();
}
@ -391,9 +391,9 @@ size_t Cpu_session_component::_weight_to_quota(size_t const weight) const
unsigned Trace::Source::_alloc_unique_id()
{
static Lock lock;
static Mutex lock;
static unsigned cnt;
Lock::Guard guard(lock);
Mutex::Guard guard(lock);
return cnt++;
}

View File

@ -20,20 +20,20 @@ using namespace Genode;
void Dataspace_component::attached_to(Rm_region &region)
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
_regions.insert(&region);
}
void Dataspace_component::detached_from(Rm_region &region)
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
_regions.remove(&region);
}
void Dataspace_component::detach_from_rm_sessions()
{
_lock.lock();
_mutex.acquire();
/* remove from all regions */
while (Rm_region *r = _regions.first()) {
@ -42,12 +42,12 @@ void Dataspace_component::detach_from_rm_sessions()
* The 'detach' function calls 'Dataspace_component::detached_from'
* and thereby removes the current region from the '_regions' list.
*/
_lock.unlock();
_mutex.release();
r->rm().detach((void *)r->base());
_lock.lock();
_mutex.acquire();
}
_lock.unlock();
_mutex.release();
}
Dataspace_component::~Dataspace_component()

View File

@ -56,7 +56,7 @@ class Genode::Account
return UNIT { _quota_guard.limit().value - _initial_limit.value };
}
Lock mutable _lock { };
Mutex mutable _mutex { };
/*
* Reference account
@ -112,7 +112,7 @@ class Genode::Account
{
if (!_ref_account) return;
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
if (_quota_guard.used().value > _initial_used.value) {
UNIT const dangling { _quota_guard.used().value - _initial_used.value };
@ -139,7 +139,7 @@ class Genode::Account
void transfer_quota(Account &other, UNIT amount)
{
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
/* transfers are permitted only from/to the reference account */
if (_ref_account != &other && other._ref_account != this)
@ -155,25 +155,25 @@ class Genode::Account
}
/* credit to 'other' */
Lock::Guard guard(other._lock);
Mutex::Guard guard(other._mutex);
other._quota_guard.upgrade(amount);
}
UNIT limit() const
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
return _quota_guard.limit();
}
UNIT used() const
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
return _quota_guard.used();
}
UNIT avail() const
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
return _quota_guard.avail();
}
@ -186,7 +186,7 @@ class Genode::Account
*/
void withdraw(UNIT amount)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
_quota_guard.withdraw(amount);
}
@ -197,7 +197,7 @@ class Genode::Account
*/
void replenish(UNIT amount)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
_quota_guard.replenish(amount);
}

View File

@ -17,7 +17,7 @@
/* Genode includes */
#include <util/list.h>
#include <base/allocator_guard.h>
#include <base/lock.h>
#include <base/mutex.h>
#include <base/session_label.h>
#include <base/rpc_server.h>
#include <cpu_session/cpu_session.h>
@ -46,9 +46,9 @@ class Genode::Cpu_session_component : public Rpc_object<Cpu_session>,
Pager_entrypoint &_pager_ep;
Allocator_guard _md_alloc; /* guarded meta-data allocator */
Cpu_thread_allocator _thread_alloc; /* meta-data allocator */
Lock _thread_alloc_lock { }; /* protect allocator access */
Mutex _thread_alloc_lock { }; /* protect allocator access */
List<Cpu_thread_component> _thread_list { };
Lock _thread_list_lock { }; /* protect thread list */
Mutex _thread_list_lock { }; /* protect thread list */
unsigned _priority; /* priority of threads
created with this
session */
@ -65,7 +65,7 @@ class Genode::Cpu_session_component : public Rpc_object<Cpu_session>,
size_t _quota { 0 };
Cpu_session_component * _ref { nullptr };
List<Cpu_session_component> _ref_members { };
Lock _ref_members_lock { };
Mutex _ref_members_lock { };
Native_cpu_component _native_cpu;
@ -87,7 +87,7 @@ class Genode::Cpu_session_component : public Rpc_object<Cpu_session>,
void _insert_ref_member(Cpu_session_component * const s)
{
Lock::Guard lock_guard(_ref_members_lock);
Mutex::Guard lock_guard(_ref_members_lock);
_ref_members.insert(s);
s->_ref = this;
}
@ -100,7 +100,7 @@ class Genode::Cpu_session_component : public Rpc_object<Cpu_session>,
void _remove_ref_member(Cpu_session_component &s)
{
Lock::Guard lock_guard(_ref_members_lock);
Mutex::Guard lock_guard(_ref_members_lock);
_unsync_remove_ref_member(s);
}
@ -117,7 +117,7 @@ class Genode::Cpu_session_component : public Rpc_object<Cpu_session>,
* Raw thread-killing functionality
*
* This function is called from the 'kill_thread' function and
* the destructor. Each these functions grab the list lock
* the destructor. Each these functions grab the list mutex
* by themselves and call this function to perform the actual
* killing.
*/

View File

@ -16,7 +16,7 @@
#define _CORE__INCLUDE__DATASPACE_COMPONENT_H_
/* Genode includes */
#include <base/lock_guard.h>
#include <base/mutex.h>
#include <base/rpc_server.h>
#include <util/list.h>
@ -48,7 +48,7 @@ namespace Genode {
Cache_attribute const _cache { CACHED };
List<Rm_region> _regions { }; /* regions this is attached to */
Lock _lock { };
Mutex _mutex { };
/*
* Holds the dataspace owner if a distinction between owner and

View File

@ -23,8 +23,8 @@ class Genode::Irq_object : public Thread_deprecated<4096> {
private:
Signal_context_capability _sig_cap { };
Lock _sync_ack;
Lock _sync_bootup;
Blockade _sync_ack { };
Blockade _sync_bootup { };
unsigned _irq;
bool _associate();
@ -37,7 +37,7 @@ class Genode::Irq_object : public Thread_deprecated<4096> {
Irq_object(unsigned irq);
void sigh(Signal_context_capability cap) { _sig_cap = cap; }
void ack_irq() { _sync_ack.unlock(); }
void ack_irq() { _sync_ack.wakeup(); }
void start() override;
};

View File

@ -17,7 +17,7 @@
/* Genode includes */
#include <base/stdint.h>
#include <base/lock.h>
#include <base/mutex.h>
#include <base/capability.h>
#include <pager.h>
#include <base/allocator_avl.h>
@ -123,7 +123,7 @@ class Genode::Rm_faulter : Fifo<Rm_faulter>::Element, Interface
private:
Pager_object &_pager_object;
Lock _lock { };
Mutex _mutex { };
Weak_ptr<Region_map_component> _faulting_region_map { };
Region_map::State _fault_state { };
@ -304,7 +304,7 @@ class Genode::Region_map_component : private Weak_object<Region_map_component>,
the region map and wait
for fault resolution */
List<Rm_client> _clients { }; /* list of RM clients using this region map */
Lock _lock { }; /* lock for map and list */
Mutex _mutex { }; /* mutex for map and list */
Pager_entrypoint &_pager_ep;
Rm_dataspace_component _ds; /* dataspace representation of region map */
Dataspace_capability _ds_cap;
@ -317,7 +317,7 @@ class Genode::Region_map_component : private Weak_object<Region_map_component>,
using Functor = Trait::Functor<decltype(&F::operator())>;
using Return_type = typename Functor::Return_type;
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
/* skip further lookup when reaching the recursion limit */
if (!level) return f(this, nullptr, 0, 0, dst_region_size);

View File

@ -33,7 +33,7 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
Allocator_guard _md_alloc;
Pager_entrypoint &_pager_ep;
Lock _region_maps_lock { };
Mutex _region_maps_lock { };
List<Region_map_component> _region_maps { };
public:
@ -51,7 +51,7 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
~Rm_session_component()
{
Lock::Guard guard(_region_maps_lock);
Mutex::Guard guard(_region_maps_lock);
while (Region_map_component *rmc = _region_maps.first()) {
_region_maps.remove(rmc);
@ -71,7 +71,7 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
Capability<Region_map> create(size_t size) override
{
Lock::Guard guard(_region_maps_lock);
Mutex::Guard guard(_region_maps_lock);
try {
Region_map_component *rm =
@ -88,7 +88,7 @@ class Genode::Rm_session_component : public Rpc_object<Rm_session>
void destroy(Capability<Region_map> cap) override
{
Lock::Guard guard(_region_maps_lock);
Mutex::Guard guard(_region_maps_lock);
Region_map_component *rm = nullptr;

View File

@ -15,8 +15,8 @@
#define _CORE__INCLUDE__RPC_CAP_FACTORY_H_
#include <base/allocator.h>
#include <base/lock.h>
#include <base/capability.h>
#include <base/mutex.h>
namespace Genode { class Rpc_cap_factory; }
@ -25,7 +25,7 @@ class Genode::Rpc_cap_factory
private:
static long _unique_id_cnt;
static Lock &_lock();
static Mutex &_mutex();
public:
@ -33,7 +33,7 @@ class Genode::Rpc_cap_factory
Native_capability alloc(Native_capability ep)
{
Lock::Guard lock_guard(_lock());
Mutex::Guard lock_guard(_mutex());
return Native_capability(ep.dst(), ++_unique_id_cnt);
}

View File

@ -16,7 +16,7 @@
/* Genode includes */
#include <base/ram_allocator.h>
#include <base/lock.h>
#include <base/mutex.h>
namespace Genode { class Synced_ram_allocator; }
@ -25,7 +25,7 @@ class Genode::Synced_ram_allocator : public Ram_allocator
{
private:
Lock mutable _lock { };
Mutex mutable _mutex { };
Ram_allocator &_alloc;
@ -35,19 +35,19 @@ class Genode::Synced_ram_allocator : public Ram_allocator
Ram_dataspace_capability alloc(size_t size, Cache_attribute cached) override
{
Lock::Guard lock_guard(_lock);
Mutex::Guard mutex_guard(_mutex);
return _alloc.alloc(size, cached);
}
void free(Ram_dataspace_capability ds) override
{
Lock::Guard lock_guard(_lock);
Mutex::Guard mutex_guard(_mutex);
_alloc.free(ds);
}
size_t dataspace_size(Ram_dataspace_capability ds) const override
{
Lock::Guard lock_guard(_lock);
Mutex::Guard mutex_guard(_mutex);
return _alloc.dataspace_size(ds);
}
};

View File

@ -15,7 +15,7 @@
#define _CORE__INCLUDE__TRACE__POLICY_REGISTRY_H_
/* Genode includes */
#include <base/lock.h>
#include <base/mutex.h>
#include <util/list.h>
namespace Genode { namespace Trace {
@ -75,7 +75,7 @@ class Genode::Trace::Policy_registry
private:
Lock _lock { };
Mutex _mutex { };
List<Policy> _policies { };
Policy &_unsynchronized_lookup(Policy_owner const &owner, Policy_id id)
@ -100,7 +100,7 @@ class Genode::Trace::Policy_registry
~Policy_registry()
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
while (Policy *p = _policies.first())
_policies.remove(p);
@ -109,7 +109,7 @@ class Genode::Trace::Policy_registry
void insert(Policy_owner const &owner, Policy_id const id,
Allocator &md_alloc, Dataspace_capability ds, size_t size)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
Policy &policy = *new (&md_alloc) Policy(owner, id, md_alloc, ds, size);
_policies.insert(&policy);
@ -117,7 +117,7 @@ class Genode::Trace::Policy_registry
void remove(Policy_owner &owner, Policy_id id)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
for (Policy *p = _policies.first(); p; ) {
Policy *tmp = p;
@ -132,7 +132,7 @@ class Genode::Trace::Policy_registry
void destroy_policies_owned_by(Policy_owner const &owner)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
while (Policy *p = _any_policy_owned_by(owner)) {
_policies.remove(p);
@ -142,14 +142,14 @@ class Genode::Trace::Policy_registry
Dataspace_capability dataspace(Policy_owner &owner, Policy_id id)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
return _unsynchronized_lookup(owner, id).dataspace();
}
size_t size(Policy_owner &owner, Policy_id id)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
return _unsynchronized_lookup(owner, id).size();
}

View File

@ -16,7 +16,7 @@
#include <util/list.h>
#include <util/string.h>
#include <base/lock.h>
#include <base/mutex.h>
#include <base/trace/types.h>
#include <base/weak_ptr.h>
@ -152,7 +152,7 @@ class Genode::Trace::Source_registry
{
private:
Lock _lock { };
Mutex _mutex { };
List<Source> _entries { };
public:
@ -163,14 +163,14 @@ class Genode::Trace::Source_registry
void insert(Source *entry)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
_entries.insert(entry);
}
void remove(Source *entry)
{
Lock::Guard guard(_lock);
Mutex::Guard guard(_mutex);
_entries.remove(entry);
}

View File

@ -22,7 +22,7 @@
/* Genode includes */
#include <util/list.h>
#include <util/string.h>
#include <base/lock.h>
#include <base/mutex.h>
#include <base/trace/types.h>
#include <base/env.h>
#include <base/weak_ptr.h>
@ -312,7 +312,7 @@ class Genode::Trace::Subject_registry
Ram_allocator &_ram;
Source_registry &_sources;
unsigned _id_cnt { 0 };
Lock _lock { };
Mutex _mutex { };
Subjects _entries { };
/**
@ -407,7 +407,7 @@ class Genode::Trace::Subject_registry
*/
~Subject_registry()
{
Lock guard(_lock);
Mutex::Guard guard(_mutex);
while (Subject *s = _entries.first())
_unsynchronized_destroy(*s);
@ -418,7 +418,7 @@ class Genode::Trace::Subject_registry
*/
void import_new_sources(Source_registry &)
{
Lock guard(_lock);
Mutex::Guard guard(_mutex);
_sources.export_sources(_tester, _inserter);
}
@ -428,7 +428,7 @@ class Genode::Trace::Subject_registry
*/
size_t subjects(Subject_id *dst, size_t dst_len)
{
Lock guard(_lock);
Mutex::Guard guard(_mutex);
unsigned i = 0;
for (Subject *s = _entries.first(); s && i < dst_len; s = s->next())
@ -446,7 +446,7 @@ class Genode::Trace::Subject_registry
*/
size_t release(Subject_id subject_id)
{
Lock guard(_lock);
Mutex::Guard guard(_mutex);
Subject &subject = _unsynchronized_lookup_by_id(subject_id);
return _unsynchronized_destroy(subject);
@ -454,7 +454,7 @@ class Genode::Trace::Subject_registry
Subject &lookup_by_id(Subject_id id)
{
Lock guard(_lock);
Mutex::Guard guard(_mutex);
return _unsynchronized_lookup_by_id(id);
}

View File

@ -15,7 +15,6 @@
/* Genode includes */
#include <base/log.h>
#include <base/lock.h>
#include <util/arg_string.h>
#include <util/misc_math.h>
@ -270,7 +269,7 @@ int Rm_client::pager(Ipc_pager &pager)
void Rm_faulter::fault(Region_map_component &faulting_region_map,
Region_map::State fault_state)
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
_faulting_region_map = faulting_region_map.weak_ptr();
_fault_state = fault_state;
@ -282,7 +281,7 @@ void Rm_faulter::fault(Region_map_component &faulting_region_map,
void Rm_faulter::dissolve_from_faulting_region_map(Region_map_component &caller)
{
/* serialize access */
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
enum { DO_LOCK = true };
if (caller.equals(_faulting_region_map)) {
@ -300,7 +299,7 @@ void Rm_faulter::dissolve_from_faulting_region_map(Region_map_component &caller)
void Rm_faulter::continue_after_resolved_fault()
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
_pager_object.wake_up();
_faulting_region_map = Genode::Weak_ptr<Genode::Region_map_component>();
@ -355,7 +354,7 @@ Region_map_component::attach(Dataspace_capability ds_cap, size_t size,
bool executable, bool writeable)
{
/* serialize access */
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
/* offset must be positive and page-aligned */
if (offset < 0 || align_addr(offset, get_page_size_log2()) != offset)
@ -520,7 +519,7 @@ void Region_map_component::unmap_region(addr_t base, size_t size)
void Region_map_component::detach(Local_addr local_addr)
{
/* serialize access */
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
/* read meta data for address */
Rm_region *region_ptr = _map.metadata(local_addr);
@ -579,7 +578,7 @@ void Region_map_component::detach(Local_addr local_addr)
void Region_map_component::add_client(Rm_client &rm_client)
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
_clients.insert(&rm_client);
}
@ -587,7 +586,7 @@ void Region_map_component::add_client(Rm_client &rm_client)
void Region_map_component::remove_client(Rm_client &rm_client)
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
_clients.remove(&rm_client);
rm_client.dissolve_from_faulting_region_map(*this);
@ -611,7 +610,7 @@ void Region_map_component::fault(Rm_faulter &faulter, addr_t pf_addr,
void Region_map_component::discard_faulter(Rm_faulter &faulter, bool do_lock)
{
if (do_lock) {
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
_faulters.remove(faulter);
} else
_faulters.remove(faulter);
@ -627,7 +626,7 @@ void Region_map_component::fault_handler(Signal_context_capability handler)
Region_map::State Region_map_component::state()
{
/* serialize access */
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
/* return ready state if there are not current faulters */
Region_map::State result;
@ -683,7 +682,7 @@ Region_map_component::~Region_map_component()
Cpu_session_capability cpu_session_cap;
Thread_capability thread_cap;
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
cl = _clients.first();
if (!cl) break;
@ -708,7 +707,7 @@ Region_map_component::~Region_map_component()
addr_t out_addr = 0;
{
Lock::Guard lock_guard(_lock);
Mutex::Guard lock_guard(_mutex);
if (!_map.any_block_addr(&out_addr))
break;
}

View File

@ -16,8 +16,8 @@
long Genode::Rpc_cap_factory::_unique_id_cnt;
Genode::Lock &Genode::Rpc_cap_factory::_lock()
Genode::Mutex &Genode::Rpc_cap_factory::_mutex()
{
static Lock static_lock;
return static_lock;
static Mutex static_mutex;
return static_mutex;
}