Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24914
b: refs/heads/master
c: 00362e3
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner authored and Linus Torvalds committed Mar 31, 2006
1 parent 6acabd9 commit 46ca6af
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2bfb646cdf348cb77c572f06d5b9d17ea205c7e2
refs/heads/master: 00362e33f65f1cb5d15e62ea5509520ce2770360
16 changes: 16 additions & 0 deletions trunk/include/linux/hrtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ struct hrtimer {
struct hrtimer_base *base;
};

/**
* struct hrtimer_sleeper - simple sleeper structure
*
* @timer: embedded timer structure
* @task: task to wake up
*
* task is set to NULL, when the timer expires.
*/
struct hrtimer_sleeper {
struct hrtimer timer;
struct task_struct *task;
};

/**
* struct hrtimer_base - the timer base for a specific clock
*
Expand Down Expand Up @@ -127,6 +140,9 @@ extern long hrtimer_nanosleep(struct timespec *rqtp,
const enum hrtimer_mode mode,
const clockid_t clockid);

extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
struct task_struct *tsk);

/* Soft interrupt function to run the hrtimer queues: */
extern void hrtimer_run_queues(void);

Expand Down
19 changes: 19 additions & 0 deletions trunk/kernel/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,25 @@ void hrtimer_run_queues(void)
* Sleep related functions:
*/

static int hrtimer_wakeup(struct hrtimer *timer)
{
struct hrtimer_sleeper *t =
container_of(timer, struct hrtimer_sleeper, timer);
struct task_struct *task = t->task;

t->task = NULL;
if (task)
wake_up_process(task);

return HRTIMER_NORESTART;
}

void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, task_t *task)
{
sl->timer.function = hrtimer_wakeup;
sl->task = task;
}

struct sleep_hrtimer {
struct hrtimer timer;
struct task_struct *task;
Expand Down

0 comments on commit 46ca6af

Please sign in to comment.