Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24915
b: refs/heads/master
c: 669d786
h: refs/heads/master
i:
  24913: 6acabd9
  24911: a65db1d
v: v3
  • Loading branch information
Thomas Gleixner authored and Linus Torvalds committed Mar 31, 2006
1 parent 46ca6af commit 30a5205
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00362e33f65f1cb5d15e62ea5509520ce2770360
refs/heads/master: 669d7868ae414cdb7b7e5df375dc8e4b47f26f6d
39 changes: 9 additions & 30 deletions trunk/kernel/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ void hrtimer_run_queues(void)
/*
* Sleep related functions:
*/

static int hrtimer_wakeup(struct hrtimer *timer)
{
struct hrtimer_sleeper *t =
Expand All @@ -675,47 +674,27 @@ void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, task_t *task)
sl->task = task;
}

struct sleep_hrtimer {
struct hrtimer timer;
struct task_struct *task;
int expired;
};

static int nanosleep_wakeup(struct hrtimer *timer)
static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mode)
{
struct sleep_hrtimer *t =
container_of(timer, struct sleep_hrtimer, timer);

t->expired = 1;
wake_up_process(t->task);

return HRTIMER_NORESTART;
}

static int __sched do_nanosleep(struct sleep_hrtimer *t, enum hrtimer_mode mode)
{
t->timer.function = nanosleep_wakeup;
t->task = current;
t->expired = 0;
hrtimer_init_sleeper(t, current);

do {
set_current_state(TASK_INTERRUPTIBLE);
hrtimer_start(&t->timer, t->timer.expires, mode);

schedule();

if (unlikely(!t->expired)) {
hrtimer_cancel(&t->timer);
mode = HRTIMER_ABS;
}
} while (!t->expired && !signal_pending(current));
hrtimer_cancel(&t->timer);
mode = HRTIMER_ABS;

} while (t->task && !signal_pending(current));

return t->expired;
return t->task == NULL;
}

static long __sched nanosleep_restart(struct restart_block *restart)
{
struct sleep_hrtimer t;
struct hrtimer_sleeper t;
struct timespec __user *rmtp;
struct timespec tu;
ktime_t time;
Expand Down Expand Up @@ -748,7 +727,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
const enum hrtimer_mode mode, const clockid_t clockid)
{
struct restart_block *restart;
struct sleep_hrtimer t;
struct hrtimer_sleeper t;
struct timespec tu;
ktime_t rem;

Expand Down

0 comments on commit 30a5205

Please sign in to comment.