Unify policy name for Native_capability_tpl.

This commit unifies the policy name for the template argument for
Native_capability_tpl to Cap_dst_policy, like suggested by Norman in the
discussion resulting from issue #145. Moreover, it takes the memcpy
operation for copying a Native_capability out of the template, which is
included by a significant bunch of files, and separates it in a library,
analog to the suggestion in issue #145.
This commit is contained in:
Stefan Kalkowski
2012-03-09 11:39:46 +01:00
committed by Norman Feske
parent 35384faa7a
commit 42b7c01685
25 changed files with 101 additions and 54 deletions

View File

@ -27,10 +27,19 @@ namespace Genode {
class Platform_thread;
struct Native_thread_id
struct Cap_dst_policy
{
typedef int Dst;
static bool valid(Dst tid) { return tid != Codezero::NILTHREAD; }
static Dst invalid() { return Codezero::NILTHREAD; }
static void copy(void* dst, Native_capability_tpl<Cap_dst_policy>* src);
};
struct Native_thread_id
{
typedef Cap_dst_policy::Dst Dst;
Dst tid;
/**
@ -51,9 +60,6 @@ namespace Genode {
Native_thread_id(Dst l4id) : tid(l4id), running_lock(0) { }
Native_thread_id(Dst l4id, Codezero::l4_mutex *rl) : tid(l4id), running_lock(rl) { }
static bool valid(Dst tid) { return tid != Codezero::NILTHREAD; }
static Dst invalid() { return Codezero::NILTHREAD; }
};
struct Native_thread
@ -107,7 +113,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<Native_thread_id> Native_capability;
typedef Native_capability_tpl<Cap_dst_policy> Native_capability;
typedef int Native_connection_state;
}