diff options
Diffstat (limited to 'kernel/timer.c')
-rw-r--r-- | kernel/timer.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index 13e2b513be01..f4152fcd9f8e 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -1154,6 +1154,20 @@ fastcall signed long __sched schedule_timeout(signed long timeout) | |||
1154 | 1154 | ||
1155 | EXPORT_SYMBOL(schedule_timeout); | 1155 | EXPORT_SYMBOL(schedule_timeout); |
1156 | 1156 | ||
1157 | signed long __sched schedule_timeout_interruptible(signed long timeout) | ||
1158 | { | ||
1159 | set_current_state(TASK_INTERRUPTIBLE); | ||
1160 | return schedule_timeout(timeout); | ||
1161 | } | ||
1162 | EXPORT_SYMBOL(schedule_timeout_interruptible); | ||
1163 | |||
1164 | signed long __sched schedule_timeout_uninterruptible(signed long timeout) | ||
1165 | { | ||
1166 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
1167 | return schedule_timeout(timeout); | ||
1168 | } | ||
1169 | EXPORT_SYMBOL(schedule_timeout_uninterruptible); | ||
1170 | |||
1157 | /* Thread ID - the internal kernel "pid" */ | 1171 | /* Thread ID - the internal kernel "pid" */ |
1158 | asmlinkage long sys_gettid(void) | 1172 | asmlinkage long sys_gettid(void) |
1159 | { | 1173 | { |
@@ -1170,8 +1184,7 @@ static long __sched nanosleep_restart(struct restart_block *restart) | |||
1170 | if (!time_after(expire, now)) | 1184 | if (!time_after(expire, now)) |
1171 | return 0; | 1185 | return 0; |
1172 | 1186 | ||
1173 | current->state = TASK_INTERRUPTIBLE; | 1187 | expire = schedule_timeout_interruptible(expire - now); |
1174 | expire = schedule_timeout(expire - now); | ||
1175 | 1188 | ||
1176 | ret = 0; | 1189 | ret = 0; |
1177 | if (expire) { | 1190 | if (expire) { |
@@ -1199,8 +1212,7 @@ asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __us | |||
1199 | return -EINVAL; | 1212 | return -EINVAL; |
1200 | 1213 | ||
1201 | expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); | 1214 | expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); |
1202 | current->state = TASK_INTERRUPTIBLE; | 1215 | expire = schedule_timeout_interruptible(expire); |
1203 | expire = schedule_timeout(expire); | ||
1204 | 1216 | ||
1205 | ret = 0; | 1217 | ret = 0; |
1206 | if (expire) { | 1218 | if (expire) { |
@@ -1598,10 +1610,8 @@ void msleep(unsigned int msecs) | |||
1598 | { | 1610 | { |
1599 | unsigned long timeout = msecs_to_jiffies(msecs) + 1; | 1611 | unsigned long timeout = msecs_to_jiffies(msecs) + 1; |
1600 | 1612 | ||
1601 | while (timeout) { | 1613 | while (timeout) |
1602 | set_current_state(TASK_UNINTERRUPTIBLE); | 1614 | timeout = schedule_timeout_uninterruptible(timeout); |
1603 | timeout = schedule_timeout(timeout); | ||
1604 | } | ||
1605 | } | 1615 | } |
1606 | 1616 | ||
1607 | EXPORT_SYMBOL(msleep); | 1617 | EXPORT_SYMBOL(msleep); |
@@ -1614,10 +1624,8 @@ unsigned long msleep_interruptible(unsigned int msecs) | |||
1614 | { | 1624 | { |
1615 | unsigned long timeout = msecs_to_jiffies(msecs) + 1; | 1625 | unsigned long timeout = msecs_to_jiffies(msecs) + 1; |
1616 | 1626 | ||
1617 | while (timeout && !signal_pending(current)) { | 1627 | while (timeout && !signal_pending(current)) |
1618 | set_current_state(TASK_INTERRUPTIBLE); | 1628 | timeout = schedule_timeout_interruptible(timeout); |
1619 | timeout = schedule_timeout(timeout); | ||
1620 | } | ||
1621 | return jiffies_to_msecs(timeout); | 1629 | return jiffies_to_msecs(timeout); |
1622 | } | 1630 | } |
1623 | 1631 | ||