Follow-up tweaks for issue #145

Because we use to pass a policy class to 'Native_capability_tpl'
we can pass the dst type as part of the policy instead of as
a separate template argument. This patch also adds documentation
of the POLICY interface as expected by 'Native_capability_tpl'.
This commit is contained in:
Norman Feske
2012-03-08 19:28:32 +01:00
parent c9c21ad39c
commit 35384faa7a
10 changed files with 85 additions and 55 deletions

View File

@ -29,7 +29,9 @@ namespace Genode {
struct Native_thread_id
{
int tid;
typedef int Dst;
Dst tid;
/**
* Pointer to thread's running lock
@ -46,12 +48,12 @@ namespace Genode {
/**
* Constructor (used as implicit constructor)
*/
Native_thread_id(int l4id) : tid(l4id), running_lock(0) { }
Native_thread_id(Dst l4id) : tid(l4id), running_lock(0) { }
Native_thread_id(int l4id, Codezero::l4_mutex *rl) : tid(l4id), running_lock(rl) { }
Native_thread_id(Dst l4id, Codezero::l4_mutex *rl) : tid(l4id), running_lock(rl) { }
static bool valid(int tid) { return tid != Codezero::NILTHREAD; }
static int invalid() { return Codezero::NILTHREAD; }
static bool valid(Dst tid) { return tid != Codezero::NILTHREAD; }
static Dst invalid() { return Codezero::NILTHREAD; }
};
struct Native_thread
@ -105,7 +107,7 @@ namespace Genode {
inline bool operator == (Native_thread_id t1, Native_thread_id t2) { return t1.tid == t2.tid; }
inline bool operator != (Native_thread_id t1, Native_thread_id t2) { return t1.tid != t2.tid; }
typedef Native_capability_tpl<int,Native_thread_id> Native_capability;
typedef Native_capability_tpl<Native_thread_id> Native_capability;
typedef int Native_connection_state;
}