summaryrefslogtreecommitdiff
path: root/pfinet/glue-include/linux/sched.h
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2001-10-14 23:33:38 +0000
committerMarcus Brinkmann <marcus@gnu.org>2001-10-14 23:33:38 +0000
commite5be942c842fc22c1c752da6ec68a45d91f37c0e (patch)
treef07642ffb6ccbe69904e08faa75fbee67aac292d /pfinet/glue-include/linux/sched.h
parent2b89b8557c47d496587edb991bfad1c268e7959d (diff)
2001-10-14 Marcus Brinkmann <marcus@gnu.org>
* glue-include/linux/sched.h (process_schedule_timeout): New function used as timer callback for schedule_timeout. (schedule_timeout): Implement it.
Diffstat (limited to 'pfinet/glue-include/linux/sched.h')
-rw-r--r--pfinet/glue-include/linux/sched.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/pfinet/glue-include/linux/sched.h b/pfinet/glue-include/linux/sched.h
index 897a2df0..f57de2c3 100644
--- a/pfinet/glue-include/linux/sched.h
+++ b/pfinet/glue-include/linux/sched.h
@@ -149,11 +149,38 @@ schedule (void)
interruptible_sleep_on (current->next_wait);
}
+static inline void
+process_schedule_timeout (unsigned long data)
+{
+ struct wait_queue **sleep = (struct wait_queue **) data;
+
+ wake_up_interruptible (sleep);
+}
+
static inline long
schedule_timeout (long timeout)
{
- /* XXX this is only ever called to do SO_LINGER, which we don't support */
- assert (!"schedule_timeout");
+ long expire = timeout + jiffies;
+ struct timer_list timer;
+ struct wait_queue *sleep = 0; /* See comment in wait.h why this suffices. */
+
+ init_timer (&timer);
+ timer.expires = expire;
+ timer.data = (unsigned long) &sleep;
+ timer.function = process_schedule_timeout;
+ add_timer (&timer);
+
+ interruptible_sleep_on (&sleep);
+ if (signal_pending (current))
+ {
+ /* We were canceled. */
+ del_timer (&timer);
+ expire -= jiffies;
+ if (expire >= 0)
+ return expire;
+ else
+ return 0;
+ }
return 0;
}