summaryrefslogtreecommitdiff
path: root/debian/patches/upstreamme0001-kern-new-function-thread_sleep_lock.patch
blob: 2729c6c19944ca4cf073dc6e3ead7c5b4f49f7ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From e9ce90462680d53e9918aeb45ed53a33af6867d3 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Sat, 25 Jul 2015 01:46:53 +0200
Subject: [PATCH gnumach 01/10] kern: new function `thread_sleep_lock'

* kern/sched_prim.c (thread_sleep_lock): New function.
* kern/sched_prim.h (thread_sleep_lock): New delcaration.
---
 kern/sched_prim.c | 18 ++++++++++++++++++
 kern/sched_prim.h |  4 ++++
 2 files changed, 22 insertions(+)

diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index e8f260e..e354a21 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -458,6 +458,24 @@ void thread_sleep(
 }
 
 /*
+ *	thread_sleep_lock:
+ *
+ *	Cause the current thread to wait until the specified event
+ *	occurs.  The specified lock is unlocked before releasing
+ *	the cpu.  (This is a convenient way to sleep without manually
+ *	calling assert_wait).
+ */
+void thread_sleep_lock(
+	event_t		event,
+	lock_t		lock,
+	boolean_t	interruptible)
+{
+	assert_wait(event, interruptible);	/* assert event */
+	lock_done(lock);			/* release the lock */
+	thread_block((void (*)()) 0);		/* block ourselves */
+}
+
+/*
  *	thread_bind:
  *
  *	Force a thread to execute on the specified processor.
diff --git a/kern/sched_prim.h b/kern/sched_prim.h
index 62698dc..83d4594 100644
--- a/kern/sched_prim.h
+++ b/kern/sched_prim.h
@@ -69,6 +69,10 @@ extern void	thread_sleep(
 	event_t		event,
 	simple_lock_t	lock,
 	boolean_t	interruptible);
+extern void	thread_sleep_lock(
+	event_t		event,
+	lock_t		lock,
+	boolean_t	interruptible);
 extern void	thread_wakeup(void);		/* for function pointers */
 extern void	thread_wakeup_prim(
 	event_t		event,
-- 
2.1.4