mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 06:38:28 +00:00
Rework the internal lock interface
With this patch, the 'futex' syscall gets used for blocking and unblocking of threads in the Linux-specific lock implementation. The 'Native_thread_id' type, which was previously used in the lock-internal 'Applicant' class to identify a thread to be woken up, was not suitable anymore for implementing this change. With this patch, the 'Thread_base*' type gets used instead, which also has the positive effect of making the public 'cancelable_lock.h' header file platform-independent. Fixes #646.
This commit is contained in:
committed by
Norman Feske
parent
7fef0ba931
commit
a99193ad90
@ -29,10 +29,9 @@
|
||||
namespace Genode {
|
||||
|
||||
/**
|
||||
* Thread ID used in lock implementation
|
||||
* Thread ID
|
||||
*
|
||||
* Unfortunately, both - PID and TID - are needed for lx_tgkill() in
|
||||
* thread_check_stopped_and_restart().
|
||||
* Unfortunately, both - PID and TID - are needed for lx_tgkill()
|
||||
*/
|
||||
struct Native_thread_id
|
||||
{
|
||||
@ -62,6 +61,11 @@ namespace Genode {
|
||||
{
|
||||
bool is_ipc_server;
|
||||
|
||||
/**
|
||||
* Natively aligned memory location used in the lock implementation
|
||||
*/
|
||||
int futex_counter __attribute__((aligned(sizeof(Genode::addr_t))));
|
||||
|
||||
/**
|
||||
* Opaque pointer to additional thread-specific meta data
|
||||
*
|
||||
@ -71,7 +75,7 @@ namespace Genode {
|
||||
*/
|
||||
Thread_meta_data *meta_data;
|
||||
|
||||
Native_thread() : is_ipc_server(false), meta_data(0) { }
|
||||
Native_thread() : is_ipc_server(false), futex_counter(0), meta_data(0) { }
|
||||
};
|
||||
|
||||
inline bool operator == (Native_thread_id t1, Native_thread_id t2) {
|
||||
|
Reference in New Issue
Block a user