mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
parent
3956530634
commit
22d71d5a8b
@ -17,7 +17,7 @@
|
|||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <file_system_session/rpc_object.h>
|
#include <file_system_session/rpc_object.h>
|
||||||
#include <util/list.h>
|
#include <util/list.h>
|
||||||
#include <base/lock.h>
|
#include <base/mutex.h>
|
||||||
#include <base/signal.h>
|
#include <base/signal.h>
|
||||||
|
|
||||||
namespace File_system {
|
namespace File_system {
|
||||||
@ -32,7 +32,7 @@ namespace File_system {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Genode::Lock _lock { };
|
Genode::Mutex _mutex { };
|
||||||
Sink &_sink;
|
Sink &_sink;
|
||||||
Node_handle const _handle;
|
Node_handle const _handle;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ namespace File_system {
|
|||||||
*/
|
*/
|
||||||
void notify(Version curr_version)
|
void notify(Version curr_version)
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard guard(_lock);
|
Genode::Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
if (curr_version.value == _handed_out_version.value)
|
if (curr_version.value == _handed_out_version.value)
|
||||||
return;
|
return;
|
||||||
@ -77,7 +77,7 @@ namespace File_system {
|
|||||||
*/
|
*/
|
||||||
void handed_out_version(Version version)
|
void handed_out_version(Version version)
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard guard(_lock);
|
Genode::Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
_handed_out_version = version;
|
_handed_out_version = version;
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,10 @@ class Genode::Child_policy_dynamic_rom_file : public Rpc_object<Rom_session>,
|
|||||||
* The ROM module may be written and consumed by different threads,
|
* The ROM module may be written and consumed by different threads,
|
||||||
* e.g., written by the main thread and consumed by the child's
|
* e.g., written by the main thread and consumed by the child's
|
||||||
* entrypoint that manages the local ROM service for handing out a
|
* entrypoint that manages the local ROM service for handing out a
|
||||||
* dynamic config. Hence, the '_lock' is used to synchronize the
|
* dynamic config. Hence, the '_mutex' is used to synchronize the
|
||||||
* 'load' and 'dataspace' methods.
|
* 'load' and 'dataspace' methods.
|
||||||
*/
|
*/
|
||||||
Lock _lock { };
|
Mutex _mutex { };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We keep two dataspaces around. The foreground ('_fg') dataspace
|
* We keep two dataspaces around. The foreground ('_fg') dataspace
|
||||||
@ -111,7 +111,7 @@ class Genode::Child_policy_dynamic_rom_file : public Rpc_object<Rom_session>,
|
|||||||
*/
|
*/
|
||||||
void load(void const *data, size_t data_len)
|
void load(void const *data, size_t data_len)
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
if (!_ram) {
|
if (!_ram) {
|
||||||
Genode::error("no backing store for loading ROM data");
|
Genode::error("no backing store for loading ROM data");
|
||||||
@ -136,7 +136,7 @@ class Genode::Child_policy_dynamic_rom_file : public Rpc_object<Rom_session>,
|
|||||||
|
|
||||||
Rom_dataspace_capability dataspace() override
|
Rom_dataspace_capability dataspace() override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
if (!_fg.size() && !_bg_has_pending_data) {
|
if (!_fg.size() && !_bg_has_pending_data) {
|
||||||
Genode::error("no data loaded");
|
Genode::error("no data loaded");
|
||||||
|
@ -74,7 +74,7 @@ class Genode::Dynamic_rom_session : public Rpc_object<Rom_session>
|
|||||||
* Synchronize calls of 'trigger_update' (called locally) with the
|
* Synchronize calls of 'trigger_update' (called locally) with the
|
||||||
* 'Rom_session' methods (invoked via RPC).
|
* 'Rom_session' methods (invoked via RPC).
|
||||||
*/
|
*/
|
||||||
Lock _lock { };
|
Mutex _mutex { };
|
||||||
|
|
||||||
Rpc_entrypoint &_ep;
|
Rpc_entrypoint &_ep;
|
||||||
Ram_allocator &_ram;
|
Ram_allocator &_ram;
|
||||||
@ -200,7 +200,7 @@ class Genode::Dynamic_rom_session : public Rpc_object<Rom_session>
|
|||||||
*/
|
*/
|
||||||
void trigger_update()
|
void trigger_update()
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
_current_version++;
|
_current_version++;
|
||||||
_notify_client();
|
_notify_client();
|
||||||
@ -213,7 +213,7 @@ class Genode::Dynamic_rom_session : public Rpc_object<Rom_session>
|
|||||||
|
|
||||||
Rom_dataspace_capability dataspace() override
|
Rom_dataspace_capability dataspace() override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
if (!_ds.constructed())
|
if (!_ds.constructed())
|
||||||
_unsynchronized_update();
|
_unsynchronized_update();
|
||||||
@ -228,14 +228,14 @@ class Genode::Dynamic_rom_session : public Rpc_object<Rom_session>
|
|||||||
|
|
||||||
bool update() override
|
bool update() override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
return _unsynchronized_update();
|
return _unsynchronized_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void sigh(Signal_context_capability sigh) override
|
void sigh(Signal_context_capability sigh) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
_sigh = sigh;
|
_sigh = sigh;
|
||||||
_notify_client();
|
_notify_client();
|
||||||
|
@ -279,7 +279,7 @@ class Genode::Packet_descriptor_transmitter
|
|||||||
/* facility to send ready-to-receive signals */
|
/* facility to send ready-to-receive signals */
|
||||||
Genode::Signal_transmitter _rx_ready { };
|
Genode::Signal_transmitter _rx_ready { };
|
||||||
|
|
||||||
Genode::Lock _tx_queue_lock { };
|
Genode::Mutex _tx_queue_mutex { };
|
||||||
TX_QUEUE *_tx_queue;
|
TX_QUEUE *_tx_queue;
|
||||||
bool _tx_wakeup_needed = false;
|
bool _tx_wakeup_needed = false;
|
||||||
|
|
||||||
@ -325,13 +325,13 @@ class Genode::Packet_descriptor_transmitter
|
|||||||
|
|
||||||
bool ready_for_tx()
|
bool ready_for_tx()
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_tx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_tx_queue_mutex);
|
||||||
return !_tx_queue->full();
|
return !_tx_queue->full();
|
||||||
}
|
}
|
||||||
|
|
||||||
void tx(typename TX_QUEUE::Packet_descriptor packet)
|
void tx(typename TX_QUEUE::Packet_descriptor packet)
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_tx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_tx_queue_mutex);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* block for signal if tx queue is full */
|
/* block for signal if tx queue is full */
|
||||||
@ -352,7 +352,7 @@ class Genode::Packet_descriptor_transmitter
|
|||||||
|
|
||||||
bool try_tx(typename TX_QUEUE::Packet_descriptor packet)
|
bool try_tx(typename TX_QUEUE::Packet_descriptor packet)
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_tx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_tx_queue_mutex);
|
||||||
|
|
||||||
if (_tx_queue->full())
|
if (_tx_queue->full())
|
||||||
return false;
|
return false;
|
||||||
@ -367,7 +367,7 @@ class Genode::Packet_descriptor_transmitter
|
|||||||
|
|
||||||
bool tx_wakeup()
|
bool tx_wakeup()
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_tx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_tx_queue_mutex);
|
||||||
|
|
||||||
bool signal_submitted = false;
|
bool signal_submitted = false;
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ class Genode::Packet_descriptor_receiver
|
|||||||
/* facility to send ready-to-transmit signals */
|
/* facility to send ready-to-transmit signals */
|
||||||
Genode::Signal_transmitter _tx_ready { };
|
Genode::Signal_transmitter _tx_ready { };
|
||||||
|
|
||||||
Genode::Lock mutable _rx_queue_lock { };
|
Genode::Mutex mutable _rx_queue_mutex { };
|
||||||
RX_QUEUE *_rx_queue;
|
RX_QUEUE *_rx_queue;
|
||||||
bool _rx_wakeup_needed = false;
|
bool _rx_wakeup_needed = false;
|
||||||
|
|
||||||
@ -451,13 +451,13 @@ class Genode::Packet_descriptor_receiver
|
|||||||
|
|
||||||
bool ready_for_rx()
|
bool ready_for_rx()
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_rx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_rx_queue_mutex);
|
||||||
return !_rx_queue->empty();
|
return !_rx_queue->empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void rx(typename RX_QUEUE::Packet_descriptor *out_packet)
|
void rx(typename RX_QUEUE::Packet_descriptor *out_packet)
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_rx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_rx_queue_mutex);
|
||||||
|
|
||||||
while (_rx_queue->empty())
|
while (_rx_queue->empty())
|
||||||
_rx_ready.wait_for_signal();
|
_rx_ready.wait_for_signal();
|
||||||
@ -470,7 +470,7 @@ class Genode::Packet_descriptor_receiver
|
|||||||
|
|
||||||
typename RX_QUEUE::Packet_descriptor try_rx()
|
typename RX_QUEUE::Packet_descriptor try_rx()
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_rx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_rx_queue_mutex);
|
||||||
|
|
||||||
typename RX_QUEUE::Packet_descriptor packet { };
|
typename RX_QUEUE::Packet_descriptor packet { };
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ class Genode::Packet_descriptor_receiver
|
|||||||
|
|
||||||
bool rx_wakeup()
|
bool rx_wakeup()
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_rx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_rx_queue_mutex);
|
||||||
|
|
||||||
bool signal_submitted = false;
|
bool signal_submitted = false;
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ class Genode::Packet_descriptor_receiver
|
|||||||
|
|
||||||
typename RX_QUEUE::Packet_descriptor rx_peek() const
|
typename RX_QUEUE::Packet_descriptor rx_peek() const
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_rx_queue_lock);
|
Genode::Mutex::Guard mutex_guard(_rx_queue_mutex);
|
||||||
return _rx_queue->peek();
|
return _rx_queue->peek();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -36,15 +36,15 @@ struct Genode::Ring_buffer_unsynchronized
|
|||||||
void up() { }
|
void up() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Lock
|
struct Mutex
|
||||||
{
|
{
|
||||||
void lock() { }
|
void acquire() { }
|
||||||
void unlock() { }
|
void release() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Lock_guard
|
struct Mutex_guard
|
||||||
{
|
{
|
||||||
Lock_guard(Lock &) { }
|
Mutex_guard(Mutex &) { }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -52,8 +52,8 @@ struct Genode::Ring_buffer_unsynchronized
|
|||||||
struct Genode::Ring_buffer_synchronized
|
struct Genode::Ring_buffer_synchronized
|
||||||
{
|
{
|
||||||
typedef Genode::Semaphore Sem;
|
typedef Genode::Semaphore Sem;
|
||||||
typedef Genode::Lock Lock;
|
typedef Genode::Mutex Mutex;
|
||||||
typedef Genode::Lock::Guard Lock_guard;
|
typedef Genode::Mutex::Guard Mutex_guard;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class Genode::Ring_buffer
|
|||||||
int _tail = 0;
|
int _tail = 0;
|
||||||
|
|
||||||
typename SYNC_POLICY::Sem _sem { }; /* element counter */
|
typename SYNC_POLICY::Sem _sem { }; /* element counter */
|
||||||
typename SYNC_POLICY::Lock _head_lock { }; /* synchronize add */
|
typename SYNC_POLICY::Mutex _head_lock { }; /* synchronize add */
|
||||||
|
|
||||||
ET _queue[QUEUE_SIZE] { };
|
ET _queue[QUEUE_SIZE] { };
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class Genode::Ring_buffer
|
|||||||
*/
|
*/
|
||||||
void add(ET ev)
|
void add(ET ev)
|
||||||
{
|
{
|
||||||
typename SYNC_POLICY::Lock_guard lock_guard(_head_lock);
|
typename SYNC_POLICY::Mutex_guard mutex_guard(_head_lock);
|
||||||
|
|
||||||
if ((_head + 1)%QUEUE_SIZE != _tail) {
|
if ((_head + 1)%QUEUE_SIZE != _tail) {
|
||||||
_queue[_head] = ev;
|
_queue[_head] = ev;
|
||||||
|
@ -190,7 +190,7 @@ class Genode::Slave::Connection_base
|
|||||||
Session_state::Closed_callback
|
Session_state::Closed_callback
|
||||||
{
|
{
|
||||||
Policy &_policy;
|
Policy &_policy;
|
||||||
Lock _lock { Lock::LOCKED };
|
Blockade _blockade { };
|
||||||
bool _alive = false;
|
bool _alive = false;
|
||||||
|
|
||||||
Service(Policy &policy)
|
Service(Policy &policy)
|
||||||
@ -240,13 +240,13 @@ class Genode::Slave::Connection_base
|
|||||||
void session_ready(Session_state &session) override
|
void session_ready(Session_state &session) override
|
||||||
{
|
{
|
||||||
_alive = session.alive();
|
_alive = session.alive();
|
||||||
_lock.unlock();
|
_blockade.wakeup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session_state::Closed_callback
|
* Session_state::Closed_callback
|
||||||
*/
|
*/
|
||||||
void session_closed(Session_state &s) override { _lock.unlock(); }
|
void session_closed(Session_state &s) override { _blockade.wakeup(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service ('Ram_transfer::Account') interface
|
* Service ('Ram_transfer::Account') interface
|
||||||
@ -290,7 +290,7 @@ class Genode::Slave::Connection_base
|
|||||||
_connection(_service, _id_space, { 1 }, args, affinity)
|
_connection(_service, _id_space, { 1 }, args, affinity)
|
||||||
{
|
{
|
||||||
_policy.trigger_session_requests();
|
_policy.trigger_session_requests();
|
||||||
_service._lock.lock();
|
_service._blockade.block();
|
||||||
if (!_service._alive)
|
if (!_service._alive)
|
||||||
throw Service_denied();
|
throw Service_denied();
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ class Genode::Slave::Connection_base
|
|||||||
~Connection_base()
|
~Connection_base()
|
||||||
{
|
{
|
||||||
_policy.trigger_session_requests();
|
_policy.trigger_session_requests();
|
||||||
_service._lock.lock();
|
_service._blockade.block();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef typename CONNECTION::Session_type SESSION;
|
typedef typename CONNECTION::Session_type SESSION;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <util/misc_math.h>
|
#include <util/misc_math.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
#include <base/lock.h>
|
#include <base/mutex.h>
|
||||||
#include <base/rpc_client.h>
|
#include <base/rpc_client.h>
|
||||||
#include <base/attached_dataspace.h>
|
#include <base/attached_dataspace.h>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class Terminal::Session_client : public Genode::Rpc_client<Session>
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Genode::Lock _lock { };
|
Genode::Mutex _mutex { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared-memory buffer used for carrying the payload
|
* Shared-memory buffer used for carrying the payload
|
||||||
@ -52,7 +52,7 @@ class Terminal::Session_client : public Genode::Rpc_client<Session>
|
|||||||
|
|
||||||
Genode::size_t read(void *buf, Genode::size_t buf_size) override
|
Genode::size_t read(void *buf, Genode::size_t buf_size) override
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard _guard(_lock);
|
Genode::Mutex::Guard _guard(_mutex);
|
||||||
|
|
||||||
/* instruct server to fill the I/O buffer */
|
/* instruct server to fill the I/O buffer */
|
||||||
Genode::size_t num_bytes = call<Rpc_read>(buf_size);
|
Genode::size_t num_bytes = call<Rpc_read>(buf_size);
|
||||||
@ -66,7 +66,7 @@ class Terminal::Session_client : public Genode::Rpc_client<Session>
|
|||||||
|
|
||||||
Genode::size_t write(void const *buf, Genode::size_t num_bytes) override
|
Genode::size_t write(void const *buf, Genode::size_t num_bytes) override
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard _guard(_lock);
|
Genode::Mutex::Guard _guard(_mutex);
|
||||||
|
|
||||||
Genode::size_t written_bytes = 0;
|
Genode::size_t written_bytes = 0;
|
||||||
char const * const src = (char const *)buf;
|
char const * const src = (char const *)buf;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <util/misc_math.h>
|
#include <util/misc_math.h>
|
||||||
#include <util/xml_node.h>
|
#include <util/xml_node.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
#include <base/lock.h>
|
#include <base/mutex.h>
|
||||||
#include <base/env.h>
|
#include <base/env.h>
|
||||||
#include <base/signal.h>
|
#include <base/signal.h>
|
||||||
#include <base/allocator.h>
|
#include <base/allocator.h>
|
||||||
@ -41,7 +41,7 @@ namespace Vfs {
|
|||||||
using Genode::memcpy;
|
using Genode::memcpy;
|
||||||
using Genode::memset;
|
using Genode::memset;
|
||||||
typedef unsigned long long file_size;
|
typedef unsigned long long file_size;
|
||||||
using Genode::Lock;
|
using Genode::Mutex;
|
||||||
using Genode::List;
|
using Genode::List;
|
||||||
using Genode::Xml_node;
|
using Genode::Xml_node;
|
||||||
using Genode::Signal_context_capability;
|
using Genode::Signal_context_capability;
|
||||||
|
@ -66,7 +66,7 @@ class Pl050
|
|||||||
_Channel(_Channel const &);
|
_Channel(_Channel const &);
|
||||||
_Channel &operator = (_Channel const &);
|
_Channel &operator = (_Channel const &);
|
||||||
|
|
||||||
Genode::Lock _lock { };
|
Genode::Mutex _mutex { };
|
||||||
Genode::Attached_io_mem_dataspace _io_mem;
|
Genode::Attached_io_mem_dataspace _io_mem;
|
||||||
volatile Genode::uint32_t *_reg_base;
|
volatile Genode::uint32_t *_reg_base;
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class Pl050
|
|||||||
*/
|
*/
|
||||||
unsigned char read() override
|
unsigned char read() override
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard guard(_lock);
|
Genode::Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
while (empty())
|
while (empty())
|
||||||
if (_input_pending())
|
if (_input_pending())
|
||||||
|
@ -114,7 +114,7 @@ class I8042
|
|||||||
*/
|
*/
|
||||||
void flush_read()
|
void flush_read()
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard guard(_i8042._lock);
|
Genode::Mutex::Guard guard(_i8042._mutex);
|
||||||
|
|
||||||
while (_i8042._output_buffer_full())
|
while (_i8042._output_buffer_full())
|
||||||
_i8042._read_and_route();
|
_i8042._read_and_route();
|
||||||
@ -143,7 +143,7 @@ class I8042
|
|||||||
|
|
||||||
void write(unsigned char value) override
|
void write(unsigned char value) override
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard guard(_i8042._lock);
|
Genode::Mutex::Guard guard(_i8042._mutex);
|
||||||
|
|
||||||
if (_aux)
|
if (_aux)
|
||||||
_i8042._command(CMD_AUX_WRITE);
|
_i8042._command(CMD_AUX_WRITE);
|
||||||
@ -255,9 +255,9 @@ class I8042
|
|||||||
* Both serial interfaces may be used by different
|
* Both serial interfaces may be used by different
|
||||||
* threads, e.g., interrupt handlers. Hence, controller
|
* threads, e.g., interrupt handlers. Hence, controller
|
||||||
* transactions (read/write sequences) must be protected
|
* transactions (read/write sequences) must be protected
|
||||||
* with a lock.
|
* with a mutex.
|
||||||
*/
|
*/
|
||||||
Genode::Lock _lock { };
|
Genode::Mutex _mutex { };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -141,9 +141,9 @@ class Platform::Irq_component : public Platform::Irq_proxy
|
|||||||
Genode::Allocator *heap = nullptr)
|
Genode::Allocator *heap = nullptr)
|
||||||
{
|
{
|
||||||
static Genode::List<Irq_proxy> proxies;
|
static Genode::List<Irq_proxy> proxies;
|
||||||
static Genode::Lock proxies_lock;
|
static Genode::Mutex proxies_mutex;
|
||||||
|
|
||||||
Genode::Lock::Guard lock_guard(proxies_lock);
|
Genode::Mutex::Guard mutex_guard(proxies_mutex);
|
||||||
|
|
||||||
/* lookup proxy in database */
|
/* lookup proxy in database */
|
||||||
for (Irq_proxy *p = proxies.first(); p; p = p->next())
|
for (Irq_proxy *p = proxies.first(); p; p = p->next())
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2017 Genode Labs GmbH
|
* Copyright (C) 2009-2020 Genode Labs GmbH
|
||||||
*
|
*
|
||||||
* This file is part of the Genode OS framework, which is distributed
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
@ -15,6 +15,8 @@
|
|||||||
#ifndef _DRIVERS__PLATFORM__SPEC__X86__IRQ_PROXY_H_
|
#ifndef _DRIVERS__PLATFORM__SPEC__X86__IRQ_PROXY_H_
|
||||||
#define _DRIVERS__PLATFORM__SPEC__X86__IRQ_PROXY_H_
|
#define _DRIVERS__PLATFORM__SPEC__X86__IRQ_PROXY_H_
|
||||||
|
|
||||||
|
#include <base/mutex.h>
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
class Irq_sigh;
|
class Irq_sigh;
|
||||||
class Irq_proxy;
|
class Irq_proxy;
|
||||||
@ -53,7 +55,7 @@ class Platform::Irq_proxy : private Genode::List<Platform::Irq_proxy>::Element
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
unsigned _irq_number;
|
unsigned _irq_number;
|
||||||
Genode::Lock _mutex; /* protects this object */
|
Genode::Mutex _mutex { }; /* protects this object */
|
||||||
int _num_sharers; /* number of clients sharing this IRQ */
|
int _num_sharers; /* number of clients sharing this IRQ */
|
||||||
|
|
||||||
Genode::List<Irq_sigh> _sigh_list { };
|
Genode::List<Irq_sigh> _sigh_list { };
|
||||||
@ -68,8 +70,7 @@ class Platform::Irq_proxy : private Genode::List<Platform::Irq_proxy>::Element
|
|||||||
|
|
||||||
Irq_proxy(unsigned irq_number)
|
Irq_proxy(unsigned irq_number)
|
||||||
:
|
:
|
||||||
_irq_number(irq_number),
|
_irq_number(irq_number), _num_sharers(0),
|
||||||
_mutex(Genode::Lock::UNLOCKED), _num_sharers(0),
|
|
||||||
_num_acknowledgers(0), _woken_up(false)
|
_num_acknowledgers(0), _woken_up(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ class Platform::Irq_proxy : private Genode::List<Platform::Irq_proxy>::Element
|
|||||||
*/
|
*/
|
||||||
virtual bool ack_irq()
|
virtual bool ack_irq()
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_mutex);
|
Genode::Mutex::Guard mutex_guard(_mutex);
|
||||||
|
|
||||||
_num_acknowledgers++;
|
_num_acknowledgers++;
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ class Platform::Irq_proxy : private Genode::List<Platform::Irq_proxy>::Element
|
|||||||
*/
|
*/
|
||||||
void notify_about_irq()
|
void notify_about_irq()
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_mutex);
|
Genode::Mutex::Guard mutex_guard(_mutex);
|
||||||
|
|
||||||
/* reset acknowledger state */
|
/* reset acknowledger state */
|
||||||
_num_acknowledgers = 0;
|
_num_acknowledgers = 0;
|
||||||
@ -115,7 +116,7 @@ class Platform::Irq_proxy : private Genode::List<Platform::Irq_proxy>::Element
|
|||||||
|
|
||||||
virtual bool add_sharer(Irq_sigh *s)
|
virtual bool add_sharer(Irq_sigh *s)
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_mutex);
|
Genode::Mutex::Guard mutex_guard(_mutex);
|
||||||
|
|
||||||
++_num_sharers;
|
++_num_sharers;
|
||||||
_sigh_list.insert(s);
|
_sigh_list.insert(s);
|
||||||
@ -125,7 +126,7 @@ class Platform::Irq_proxy : private Genode::List<Platform::Irq_proxy>::Element
|
|||||||
|
|
||||||
virtual bool remove_sharer(Irq_sigh *s)
|
virtual bool remove_sharer(Irq_sigh *s)
|
||||||
{
|
{
|
||||||
Genode::Lock::Guard lock_guard(_mutex);
|
Genode::Mutex::Guard mutex_guard(_mutex);
|
||||||
|
|
||||||
_sigh_list.remove(s);
|
_sigh_list.remove(s);
|
||||||
--_num_sharers;
|
--_num_sharers;
|
||||||
|
@ -34,7 +34,7 @@ class Vfs::Block_file_system : public Single_file_system
|
|||||||
/*
|
/*
|
||||||
* Serialize access to packet stream of the block session
|
* Serialize access to packet stream of the block session
|
||||||
*/
|
*/
|
||||||
Lock _lock { };
|
Mutex _mutex { };
|
||||||
|
|
||||||
char *_block_buffer;
|
char *_block_buffer;
|
||||||
unsigned _block_buffer_count;
|
unsigned _block_buffer_count;
|
||||||
@ -66,7 +66,7 @@ class Vfs::Block_file_system : public Single_file_system
|
|||||||
|
|
||||||
Genode::Allocator &_alloc;
|
Genode::Allocator &_alloc;
|
||||||
Label &_label;
|
Label &_label;
|
||||||
Lock &_lock;
|
Mutex &_mutex;
|
||||||
char *_block_buffer;
|
char *_block_buffer;
|
||||||
unsigned &_block_buffer_count;
|
unsigned &_block_buffer_count;
|
||||||
Genode::Allocator_avl &_tx_block_alloc;
|
Genode::Allocator_avl &_tx_block_alloc;
|
||||||
@ -104,7 +104,7 @@ class Vfs::Block_file_system : public Single_file_system
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
packet = _block.alloc_packet(packet_size);
|
packet = _block.alloc_packet(packet_size);
|
||||||
break;
|
break;
|
||||||
@ -119,7 +119,7 @@ class Vfs::Block_file_system : public Single_file_system
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Block::Packet_descriptor p(packet, op, nr, packet_count);
|
Block::Packet_descriptor p(packet, op, nr, packet_count);
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ class Vfs::Block_file_system : public Single_file_system
|
|||||||
File_io_service &fs,
|
File_io_service &fs,
|
||||||
Genode::Allocator &alloc,
|
Genode::Allocator &alloc,
|
||||||
Label &label,
|
Label &label,
|
||||||
Lock &lock,
|
Mutex &mutex,
|
||||||
char *block_buffer,
|
char *block_buffer,
|
||||||
unsigned &block_buffer_count,
|
unsigned &block_buffer_count,
|
||||||
Genode::Allocator_avl &tx_block_alloc,
|
Genode::Allocator_avl &tx_block_alloc,
|
||||||
@ -163,7 +163,7 @@ class Vfs::Block_file_system : public Single_file_system
|
|||||||
: Single_vfs_handle(ds, fs, alloc, 0),
|
: Single_vfs_handle(ds, fs, alloc, 0),
|
||||||
_alloc(alloc),
|
_alloc(alloc),
|
||||||
_label(label),
|
_label(label),
|
||||||
_lock(lock),
|
_mutex(mutex),
|
||||||
_block_buffer(block_buffer),
|
_block_buffer(block_buffer),
|
||||||
_block_buffer_count(block_buffer_count),
|
_block_buffer_count(block_buffer_count),
|
||||||
_tx_block_alloc(tx_block_alloc),
|
_tx_block_alloc(tx_block_alloc),
|
||||||
@ -393,7 +393,7 @@ class Vfs::Block_file_system : public Single_file_system
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
*out_handle = new (alloc) Block_vfs_handle(*this, *this, alloc,
|
*out_handle = new (alloc) Block_vfs_handle(*this, *this, alloc,
|
||||||
_label, _lock,
|
_label, _mutex,
|
||||||
_block_buffer,
|
_block_buffer,
|
||||||
_block_buffer_count,
|
_block_buffer_count,
|
||||||
_tx_block_alloc,
|
_tx_block_alloc,
|
||||||
|
@ -29,13 +29,13 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock used to serialize the interaction with the packet stream of the
|
* Mutex used to serialize the interaction with the packet stream of the
|
||||||
* file-system session.
|
* file-system session.
|
||||||
*
|
*
|
||||||
* XXX Once, we change the VFS file-system interface to use
|
* XXX Once, we change the VFS file-system interface to use
|
||||||
* asynchronous read/write operations, we can possibly remove it.
|
* asynchronous read/write operations, we can possibly remove it.
|
||||||
*/
|
*/
|
||||||
Lock _lock { };
|
Mutex _mutex { };
|
||||||
|
|
||||||
Vfs::Env &_env;
|
Vfs::Env &_env;
|
||||||
Genode::Allocator_avl _fs_packet_alloc { &_env.alloc() };
|
Genode::Allocator_avl _fs_packet_alloc { &_env.alloc() };
|
||||||
@ -601,12 +601,12 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
Genode::warning("ack for unknown File_system handle ", id); }
|
Genode::warning("ack for unknown File_system handle ", id); }
|
||||||
|
|
||||||
if (packet.operation() == Packet_descriptor::WRITE) {
|
if (packet.operation() == Packet_descriptor::WRITE) {
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
source.release_packet(packet);
|
source.release_packet(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.operation() == Packet_descriptor::WRITE_TIMESTAMP) {
|
if (packet.operation() == Packet_descriptor::WRITE_TIMESTAMP) {
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
source.release_packet(packet);
|
source.release_packet(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -801,7 +801,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
Open_result open(char const *path, unsigned vfs_mode, Vfs_handle **out_handle,
|
Open_result open(char const *path, unsigned vfs_mode, Vfs_handle **out_handle,
|
||||||
Genode::Allocator& alloc) override
|
Genode::Allocator& alloc) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Absolute_path dir_path(path);
|
Absolute_path dir_path(path);
|
||||||
dir_path.strip_last_element();
|
dir_path.strip_last_element();
|
||||||
@ -848,7 +848,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
Opendir_result opendir(char const *path, bool create,
|
Opendir_result opendir(char const *path, bool create,
|
||||||
Vfs_handle **out_handle, Allocator &alloc) override
|
Vfs_handle **out_handle, Allocator &alloc) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Absolute_path dir_path(path);
|
Absolute_path dir_path(path);
|
||||||
|
|
||||||
@ -873,7 +873,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
Openlink_result openlink(char const *path, bool create,
|
Openlink_result openlink(char const *path, bool create,
|
||||||
Vfs_handle **out_handle, Allocator &alloc) override
|
Vfs_handle **out_handle, Allocator &alloc) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Canonicalize path (i.e., path must start with '/')
|
* Canonicalize path (i.e., path must start with '/')
|
||||||
@ -914,7 +914,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
|
|
||||||
void close(Vfs_handle *vfs_handle) override
|
void close(Vfs_handle *vfs_handle) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Fs_vfs_handle *fs_handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
Fs_vfs_handle *fs_handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
||||||
if (fs_handle->enqueued())
|
if (fs_handle->enqueued())
|
||||||
@ -976,7 +976,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
Write_result write(Vfs_handle *vfs_handle, char const *buf,
|
Write_result write(Vfs_handle *vfs_handle, char const *buf,
|
||||||
file_size buf_size, file_size &out_count) override
|
file_size buf_size, file_size &out_count) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Fs_vfs_handle &handle = static_cast<Fs_vfs_handle &>(*vfs_handle);
|
Fs_vfs_handle &handle = static_cast<Fs_vfs_handle &>(*vfs_handle);
|
||||||
|
|
||||||
@ -986,7 +986,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
|
|
||||||
bool queue_read(Vfs_handle *vfs_handle, file_size count) override
|
bool queue_read(Vfs_handle *vfs_handle, file_size count) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Fs_vfs_handle *handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
Fs_vfs_handle *handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
||||||
|
|
||||||
@ -999,7 +999,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
Read_result complete_read(Vfs_handle *vfs_handle, char *dst, file_size count,
|
Read_result complete_read(Vfs_handle *vfs_handle, char *dst, file_size count,
|
||||||
file_size &out_count) override
|
file_size &out_count) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
out_count = 0;
|
out_count = 0;
|
||||||
|
|
||||||
@ -1064,7 +1064,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
|
|
||||||
bool queue_sync(Vfs_handle *vfs_handle) override
|
bool queue_sync(Vfs_handle *vfs_handle) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Fs_vfs_handle *handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
Fs_vfs_handle *handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
||||||
|
|
||||||
@ -1073,7 +1073,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
|
|
||||||
Sync_result complete_sync(Vfs_handle *vfs_handle) override
|
Sync_result complete_sync(Vfs_handle *vfs_handle) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Fs_vfs_handle *handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
Fs_vfs_handle *handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
||||||
|
|
||||||
@ -1082,7 +1082,7 @@ class Vfs::Fs_file_system : public File_system
|
|||||||
|
|
||||||
bool update_modification_timestamp(Vfs_handle *vfs_handle, Vfs::Timestamp time) override
|
bool update_modification_timestamp(Vfs_handle *vfs_handle, Vfs::Timestamp time) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Fs_vfs_handle *handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
Fs_vfs_handle *handle = static_cast<Fs_vfs_handle *>(vfs_handle);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ struct Vfs_ram::Watch_handle final : public Vfs_watch_handle,
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Vfs_ram::Node : private Genode::Avl_node<Node>, private Genode::Lock
|
class Vfs_ram::Node : private Genode::Avl_node<Node>, private Genode::Mutex
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -123,8 +123,8 @@ class Vfs_ram::Node : private Genode::Avl_node<Node>, private Genode::Lock
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using Lock::lock;
|
using Mutex::acquire;
|
||||||
using Lock::unlock;
|
using Mutex::release;
|
||||||
|
|
||||||
unsigned inode;
|
unsigned inode;
|
||||||
|
|
||||||
@ -245,9 +245,9 @@ class Vfs_ram::Node : private Genode::Avl_node<Node>, private Genode::Lock
|
|||||||
{
|
{
|
||||||
Node &node;
|
Node &node;
|
||||||
|
|
||||||
Guard(Node *guard_node) : node(*guard_node) { node.lock(); }
|
Guard(Node *guard_node) : node(*guard_node) { node.acquire(); }
|
||||||
|
|
||||||
~Guard() { node.unlock(); }
|
~Guard() { node.release(); }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -737,9 +737,9 @@ class Vfs::Ram_file_system : public Vfs::File_system
|
|||||||
try { link = new (_env.alloc()) Symlink(name); }
|
try { link = new (_env.alloc()) Symlink(name); }
|
||||||
catch (Out_of_memory) { return OPENLINK_ERR_NO_SPACE; }
|
catch (Out_of_memory) { return OPENLINK_ERR_NO_SPACE; }
|
||||||
|
|
||||||
link->lock();
|
link->acquire();
|
||||||
parent->adopt(link);
|
parent->adopt(link);
|
||||||
link->unlock();
|
link->release();
|
||||||
parent->notify();
|
parent->notify();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -838,7 +838,7 @@ class Vfs::Ram_file_system : public Vfs::File_system
|
|||||||
|
|
||||||
/* unlock the node so a second guard can be constructed */
|
/* unlock the node so a second guard can be constructed */
|
||||||
if (from_dir == to_dir)
|
if (from_dir == to_dir)
|
||||||
from_dir->unlock();
|
from_dir->Node::release();
|
||||||
|
|
||||||
Node::Guard to_guard(to_dir);
|
Node::Guard to_guard(to_dir);
|
||||||
|
|
||||||
@ -848,7 +848,7 @@ class Vfs::Ram_file_system : public Vfs::File_system
|
|||||||
|
|
||||||
Node *to_node = to_dir->child(new_name);
|
Node *to_node = to_dir->child(new_name);
|
||||||
if (to_node) {
|
if (to_node) {
|
||||||
to_node->lock();
|
to_node->acquire();
|
||||||
|
|
||||||
if (Directory *dir = dynamic_cast<Directory*>(to_node))
|
if (Directory *dir = dynamic_cast<Directory*>(to_node))
|
||||||
if (dir->length() || (!dynamic_cast<Directory*>(from_node)))
|
if (dir->length() || (!dynamic_cast<Directory*>(from_node)))
|
||||||
@ -885,7 +885,7 @@ class Vfs::Ram_file_system : public Vfs::File_system
|
|||||||
Node *node = parent->child(basename(path));
|
Node *node = parent->child(basename(path));
|
||||||
if (!node) return UNLINK_ERR_NO_ENTRY;
|
if (!node) return UNLINK_ERR_NO_ENTRY;
|
||||||
|
|
||||||
node->lock();
|
node->acquire();
|
||||||
parent->release(node);
|
parent->release(node);
|
||||||
node->notify();
|
node->notify();
|
||||||
parent->notify();
|
parent->notify();
|
||||||
|
@ -492,7 +492,7 @@ class Vfs::Tar_file_system : public File_system
|
|||||||
|
|
||||||
struct Num_dirent_cache
|
struct Num_dirent_cache
|
||||||
{
|
{
|
||||||
Lock lock { };
|
Mutex mutex { };
|
||||||
Node &root_node;
|
Node &root_node;
|
||||||
bool valid; /* true after first lookup */
|
bool valid; /* true after first lookup */
|
||||||
char key[256]; /* key used for lookup */
|
char key[256]; /* key used for lookup */
|
||||||
@ -503,7 +503,7 @@ class Vfs::Tar_file_system : public File_system
|
|||||||
|
|
||||||
file_size num_dirent(char const *path)
|
file_size num_dirent(char const *path)
|
||||||
{
|
{
|
||||||
Lock::Guard guard(lock);
|
Mutex::Guard guard(mutex);
|
||||||
|
|
||||||
/* check for cache miss */
|
/* check for cache miss */
|
||||||
if (!valid || strcmp(path, key) != 0) {
|
if (!valid || strcmp(path, key) != 0) {
|
||||||
|
@ -43,7 +43,7 @@ class Loader::Session_component : public Rpc_object<Session>
|
|||||||
Entrypoint &_ep;
|
Entrypoint &_ep;
|
||||||
Allocator &_md_alloc;
|
Allocator &_md_alloc;
|
||||||
Rom_module_registry &_rom_modules;
|
Rom_module_registry &_rom_modules;
|
||||||
Lock _lock { };
|
Mutex _mutex { };
|
||||||
List<Rom_session_component> _rom_sessions { };
|
List<Rom_session_component> _rom_sessions { };
|
||||||
|
|
||||||
void _close(Rom_session_component &rom)
|
void _close(Rom_session_component &rom)
|
||||||
@ -61,7 +61,7 @@ class Loader::Session_component : public Rpc_object<Session>
|
|||||||
|
|
||||||
~Local_rom_factory()
|
~Local_rom_factory()
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
while (_rom_sessions.first())
|
while (_rom_sessions.first())
|
||||||
_close(*_rom_sessions.first());
|
_close(*_rom_sessions.first());
|
||||||
@ -71,7 +71,7 @@ class Loader::Session_component : public Rpc_object<Session>
|
|||||||
{
|
{
|
||||||
/* try to find ROM module at local ROM service */
|
/* try to find ROM module at local ROM service */
|
||||||
try {
|
try {
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Session_label const label = label_from_args(args.string());
|
Session_label const label = label_from_args(args.string());
|
||||||
Session_label const name = label.last_element();
|
Session_label const name = label.last_element();
|
||||||
@ -94,7 +94,7 @@ class Loader::Session_component : public Rpc_object<Session>
|
|||||||
|
|
||||||
void destroy(Rom_session_component &session) override
|
void destroy(Rom_session_component &session) override
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
_close(session);
|
_close(session);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace Genode {
|
|||||||
|
|
||||||
Signal_context_capability _sigh { };
|
Signal_context_capability _sigh { };
|
||||||
|
|
||||||
Lock _lock { Lock::LOCKED };
|
Blockade _blockade { };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ namespace Genode {
|
|||||||
|
|
||||||
bool has_name(Name const &name) const { return _name == name; }
|
bool has_name(Name const &name) const { return _name == name; }
|
||||||
|
|
||||||
void lock() { _lock.lock(); }
|
void lock() { _blockade.block(); }
|
||||||
void unlock() { _lock.unlock(); }
|
void unlock() { _blockade.wakeup(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return dataspace as handed out to loader session
|
* Return dataspace as handed out to loader session
|
||||||
@ -155,7 +155,7 @@ namespace Genode {
|
|||||||
|
|
||||||
Env &_env;
|
Env &_env;
|
||||||
Xml_node const _config;
|
Xml_node const _config;
|
||||||
Lock _lock { };
|
Mutex _mutex { };
|
||||||
Ram_allocator &_ram_allocator;
|
Ram_allocator &_ram_allocator;
|
||||||
Allocator &_md_alloc;
|
Allocator &_md_alloc;
|
||||||
List<Rom_module> _list { };
|
List<Rom_module> _list { };
|
||||||
@ -184,7 +184,7 @@ namespace Genode {
|
|||||||
|
|
||||||
~Rom_module_registry()
|
~Rom_module_registry()
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
while (_list.first()) {
|
while (_list.first()) {
|
||||||
Rom_module *rom = _list.first();
|
Rom_module *rom = _list.first();
|
||||||
@ -201,7 +201,7 @@ namespace Genode {
|
|||||||
*/
|
*/
|
||||||
Rom_module &lookup_and_lock(Rom_module::Name const &name)
|
Rom_module &lookup_and_lock(Rom_module::Name const &name)
|
||||||
{
|
{
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Rom_module *curr = _list.first();
|
Rom_module *curr = _list.first();
|
||||||
for (; curr; curr = curr->next()) {
|
for (; curr; curr = curr->next()) {
|
||||||
@ -222,7 +222,7 @@ namespace Genode {
|
|||||||
}
|
}
|
||||||
catch (Lookup_failed) {
|
catch (Lookup_failed) {
|
||||||
|
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Rom_module *module = new (&_md_alloc)
|
Rom_module *module = new (&_md_alloc)
|
||||||
Rom_module(_env, _config, name, _ram_allocator,
|
Rom_module(_env, _config, name, _ram_allocator,
|
||||||
@ -243,7 +243,7 @@ namespace Genode {
|
|||||||
}
|
}
|
||||||
catch (Lookup_failed) {
|
catch (Lookup_failed) {
|
||||||
|
|
||||||
Lock::Guard guard(_lock);
|
Mutex::Guard guard(_mutex);
|
||||||
|
|
||||||
Rom_module *module = new (&_md_alloc)
|
Rom_module *module = new (&_md_alloc)
|
||||||
Rom_module(_env, _config, name, _ram_allocator,
|
Rom_module(_env, _config, name, _ram_allocator,
|
||||||
|
@ -140,8 +140,8 @@ unique_child_name(Children const &children, Bomb_child::Name const &binary_name,
|
|||||||
unsigned const generation)
|
unsigned const generation)
|
||||||
{
|
{
|
||||||
/* serialize calls to this function */
|
/* serialize calls to this function */
|
||||||
static Lock lock;
|
static Mutex mutex;
|
||||||
Lock::Guard guard(lock);
|
Mutex::Guard guard(mutex);
|
||||||
|
|
||||||
for (unsigned cnt = 1; ; cnt++) {
|
for (unsigned cnt = 1; ; cnt++) {
|
||||||
|
|
||||||
|
@ -193,8 +193,6 @@ class Test::Parent
|
|||||||
|
|
||||||
Timer::Connection _timer { _env };
|
Timer::Connection _timer { _env };
|
||||||
|
|
||||||
Lock _yield_blockade { };
|
|
||||||
|
|
||||||
void _print_status()
|
void _print_status()
|
||||||
{
|
{
|
||||||
log("quota: ", _child.pd().ram_quota().value / 1024, " KiB "
|
log("quota: ", _child.pd().ram_quota().value / 1024, " KiB "
|
||||||
|
@ -101,7 +101,7 @@ struct Lock_test : Test
|
|||||||
|
|
||||||
bool stop { false };
|
bool stop { false };
|
||||||
Microseconds us { 1000 };
|
Microseconds us { 1000 };
|
||||||
Lock lock { };
|
Mutex mutex { };
|
||||||
Timer::One_shot_timeout<Lock_test> ot1 { timer, *this, &Lock_test::handle_ot1 };
|
Timer::One_shot_timeout<Lock_test> ot1 { timer, *this, &Lock_test::handle_ot1 };
|
||||||
Timer::One_shot_timeout<Lock_test> ot2 { timer, *this, &Lock_test::handle_ot2 };
|
Timer::One_shot_timeout<Lock_test> ot2 { timer, *this, &Lock_test::handle_ot2 };
|
||||||
Timer::One_shot_timeout<Lock_test> ot3 { timer, *this, &Lock_test::handle_ot3 };
|
Timer::One_shot_timeout<Lock_test> ot3 { timer, *this, &Lock_test::handle_ot3 };
|
||||||
@ -129,7 +129,7 @@ struct Lock_test : Test
|
|||||||
stop = true;
|
stop = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Lock_guard<Lock> lock_guard(lock);
|
Mutex::Guard mutex_guard(mutex);
|
||||||
us.value--;
|
us.value--;
|
||||||
ot.schedule(us);
|
ot.schedule(us);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user