2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Implementation of Thread API interface on top of Platform_thread
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2006-05-03
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2006-2013 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
|
|
|
#include <base/thread.h>
|
|
|
|
#include <base/sleep.h>
|
|
|
|
|
|
|
|
/* core includes */
|
|
|
|
#include <platform.h>
|
|
|
|
#include <core_env.h>
|
|
|
|
|
|
|
|
using namespace Genode;
|
|
|
|
|
|
|
|
|
|
|
|
void Thread_base::_thread_start()
|
|
|
|
{
|
|
|
|
Thread_base::myself()->_thread_bootstrap();
|
|
|
|
Thread_base::myself()->entry();
|
2012-11-16 13:53:37 +01:00
|
|
|
Thread_base::myself()->_join_lock.unlock();
|
2011-12-22 16:19:25 +01:00
|
|
|
sleep_forever();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Thread_base::start()
|
|
|
|
{
|
|
|
|
/* create and start platform thread */
|
2014-03-10 15:24:53 +01:00
|
|
|
_tid.pt = new(platform_specific()->thread_slab())
|
2014-10-16 11:15:46 +02:00
|
|
|
Platform_thread(0, _context->name);
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
platform_specific()->core_pd()->bind_thread(_tid.pt);
|
|
|
|
|
2014-01-17 17:22:32 +01:00
|
|
|
_tid.pt->start((void *)_thread_start, stack_top());
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Thread_base::cancel_blocking()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Within core, we never need to unblock threads
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Thread_base::_deinit_platform_thread()
|
|
|
|
{
|
|
|
|
/* destruct platform thread */
|
2014-03-10 15:24:53 +01:00
|
|
|
destroy(platform_specific()->thread_slab(), _tid.pt);
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|