2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Semaphore implementation with timeout facility.
|
|
|
|
* \author Stefan Kalkowski
|
|
|
|
* \date 2010-03-05
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2010-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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <os/timed_semaphore.h>
|
|
|
|
|
|
|
|
|
|
|
|
void Genode::Timeout_thread::entry()
|
|
|
|
{
|
|
|
|
while (true) {
|
2013-07-18 10:43:28 +02:00
|
|
|
Signal s = _receiver.wait_for_signal();
|
|
|
|
|
|
|
|
/* increase jiffies counter related to received signals */
|
|
|
|
_time += JIFFIES_STEP_MS * s.num();
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
/* handle timouts of this point in time */
|
2013-07-18 10:43:28 +02:00
|
|
|
Genode::Alarm_scheduler::handle(_time);
|
2011-12-22 16:19:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Genode::Timeout_thread *Genode::Timeout_thread::alarm_timer()
|
|
|
|
{
|
|
|
|
static Timeout_thread _alarm_timer;
|
|
|
|
return &_alarm_timer;
|
|
|
|
}
|