mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 23:28:29 +00:00
base: remove Cancelable_lock
- base/cancelable_lock.h becomes base/lock.h - all members become private within base/lock.h - solely Mutex and Blockade are friends to use base/lock.h Fixes #3819
This commit is contained in:
committed by
Christian Helmuth
parent
0ed7367c97
commit
41380ff769
@ -15,7 +15,6 @@
|
||||
#define _CORE__INCLUDE__RPC_CAP_FACTORY_H_
|
||||
|
||||
#include <base/allocator.h>
|
||||
#include <base/lock.h>
|
||||
#include <base/capability.h>
|
||||
|
||||
namespace Genode { class Rpc_cap_factory; }
|
||||
|
@ -12,7 +12,6 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/cancelable_lock.h>
|
||||
#include <base/thread.h>
|
||||
#include <cpu/atomic.h>
|
||||
#include <cpu/memory_barrier.h>
|
||||
@ -25,7 +24,7 @@ namespace Fiasco {
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Cancelable_lock::Cancelable_lock(Cancelable_lock::State initial)
|
||||
Lock::Lock(Lock::State initial)
|
||||
: _state(UNLOCKED), _owner(nullptr)
|
||||
{
|
||||
if (initial == LOCKED)
|
||||
@ -33,28 +32,27 @@ Cancelable_lock::Cancelable_lock(Cancelable_lock::State initial)
|
||||
}
|
||||
|
||||
|
||||
void Cancelable_lock::lock()
|
||||
void Lock::lock()
|
||||
{
|
||||
Applicant myself(Thread::myself());
|
||||
lock(myself);
|
||||
}
|
||||
|
||||
|
||||
void Cancelable_lock::lock(Applicant &myself)
|
||||
void Lock::lock(Applicant &myself)
|
||||
{
|
||||
/*
|
||||
* XXX: How to notice cancel-blocking signals issued when being outside the
|
||||
* 'l4_ipc_sleep' system call?
|
||||
*/
|
||||
while (!Genode::cmpxchg(&_state, UNLOCKED, LOCKED))
|
||||
if (Fiasco::l4_ipc_sleep(Fiasco::l4_ipc_timeout(0, 0, 500, 0)) != L4_IPC_RETIMEOUT)
|
||||
throw Genode::Blocking_canceled();
|
||||
Fiasco::l4_ipc_sleep(Fiasco::l4_ipc_timeout(0, 0, 500, 0));
|
||||
|
||||
_owner = myself;
|
||||
}
|
||||
|
||||
|
||||
void Cancelable_lock::unlock()
|
||||
void Lock::unlock()
|
||||
{
|
||||
_owner = Applicant(nullptr);
|
||||
Genode::memory_barrier();
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/sleep.h>
|
||||
#include <base/lock.h>
|
||||
|
||||
/* L4/Fiasco includes */
|
||||
namespace Fiasco {
|
||||
|
Reference in New Issue
Block a user