mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-29 05:34:23 +00:00
netperf: remove mechanism to update 'times_up'
The mechanism relied on deprecated Genode APIs. To revive the mechanism, we could use pthread_create.
This commit is contained in:
parent
486e534df0
commit
cb36d96569
@ -11,79 +11,14 @@
|
|||||||
* under the terms of the GNU Affero General Public License version 3.
|
* under the terms of the GNU Affero General Public License version 3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <base/alarm.h>
|
#include <base/log.h>
|
||||||
#include <base/thread.h>
|
|
||||||
#include <timer_session/connection.h>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace Genode;
|
|
||||||
|
|
||||||
class Alarm_thread : Thread_deprecated<2048*sizeof(long)>, public Alarm_scheduler
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
Timer::Connection _timer;
|
|
||||||
Alarm::Time _curr_time; /* jiffies value */
|
|
||||||
|
|
||||||
enum { TIMER_GRANULARITY_MSEC = 10 };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Thread entry function
|
|
||||||
*/
|
|
||||||
void entry()
|
|
||||||
{
|
|
||||||
while (true) {
|
|
||||||
_timer.msleep(TIMER_GRANULARITY_MSEC);
|
|
||||||
Alarm_scheduler::handle(_curr_time);
|
|
||||||
_curr_time += TIMER_GRANULARITY_MSEC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
Alarm_thread(): Thread_deprecated("netperf_alarm"), _curr_time(0) { start(); }
|
|
||||||
|
|
||||||
Alarm::Time curr_time() { return _curr_time; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* defined in "ports/contrib/netperf/src/netlib.c" */
|
/* defined in "ports/contrib/netperf/src/netlib.c" */
|
||||||
extern "C" int times_up;
|
extern "C" int times_up;
|
||||||
|
|
||||||
|
|
||||||
class One_shot : public Alarm
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
Alarm_scheduler *_scheduler;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
One_shot(Alarm_scheduler *scheduler) : _scheduler(scheduler) { }
|
|
||||||
|
|
||||||
void set_timeout(Time absolute_timeout)
|
|
||||||
{
|
|
||||||
_scheduler->schedule_absolute(this, absolute_timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
bool on_alarm(unsigned) override
|
|
||||||
{
|
|
||||||
times_up = 1;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void
|
extern "C" void
|
||||||
start_timer(int time)
|
start_timer(int time)
|
||||||
{
|
{
|
||||||
static Alarm_thread alarm_thread;
|
Genode::warning(__func__, " not implemented, 'times_up' is never updated");
|
||||||
static One_shot oneshot(&alarm_thread);
|
|
||||||
|
|
||||||
oneshot.set_timeout(alarm_thread.curr_time() + time * 1000);
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user