hw: initialize Platform_thread::_main_thread right

Ref #766
This commit is contained in:
Martin Stein 2013-06-06 17:02:22 +02:00 committed by Norman Feske
parent cb76c0c45f
commit 5a3e340699
2 changed files with 12 additions and 4 deletions

View File

@ -47,7 +47,6 @@ namespace Genode {
Weak_ptr<Address_space> _address_space;
unsigned _id;
Rm_client * _rm_client;
bool _main_thread;
Native_utcb * _phys_utcb;
Native_utcb * _virt_utcb;
Tlb * _tlb;
@ -55,6 +54,16 @@ namespace Genode {
char _name[NAME_MAX_LEN];
char _kernel_thread[sizeof(Kernel::Thread)];
/*
* Wether this thread is the main thread of a program.
* This should be used only after 'join_pd' was called
* or if this is a core thread. For core threads its save
* also without 'join_pd' because '_main_thread' is initialized
* with 0 wich is always true as cores main thread has no
* 'Platform_thread'.
*/
bool _main_thread;
/**
* Common construction part
*/

View File

@ -60,13 +60,12 @@ Platform_thread::~Platform_thread()
Kernel::delete_thread(_id);
}
Platform_thread::Platform_thread(const char * name,
Thread_base * const thread_base,
size_t const stack_size, unsigned const pd_id)
:
_thread_base(thread_base), _stack_size(stack_size),
_pd_id(pd_id), _rm_client(0), _virt_utcb(0)
_pd_id(pd_id), _rm_client(0), _virt_utcb(0), _main_thread(0)
{
strncpy(_name, name, NAME_MAX_LEN);
@ -85,7 +84,7 @@ Platform_thread::Platform_thread(const char * name, unsigned int priority,
addr_t utcb)
:
_thread_base(0), _stack_size(0), _pd_id(0), _rm_client(0),
_virt_utcb((Native_utcb *)utcb)
_virt_utcb((Native_utcb *)utcb), _main_thread(0)
{
strncpy(_name, name, NAME_MAX_LEN);