Browse code

- moved sched_yield() wrapper into sched_yield.h at Miklos's request.

Andrei Pelinescu-Onciul authored on 13/07/2007 15:12:46
Showing 3 changed files
... ...
@@ -63,14 +63,7 @@
63 63
 #ifndef fastlock_h
64 64
 #define fastlock_h
65 65
 
66
-#ifdef HAVE_SCHED_YIELD
67
-#include <sched.h>
68
-#else
69
-#include <unistd.h>
70
-	/* fake sched_yield */
71
-	#define sched_yield()	sleep(0)
72
-#endif
73
-
66
+#include "sched_yield.h"
74 67
 
75 68
 
76 69
 #define SPIN_OPTIMIZE /* if defined optimize spining on the lock:
77 70
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+/*
1
+ * sched_yield wrapper
2
+ *
3
+ * $Id$
4
+ *
5
+ * 
6
+ *
7
+ * Copyright (C) 2001-2003 FhG Fokus
8
+ *
9
+ * Permission to use, copy, modify, and distribute this software for any
10
+ * purpose with or without fee is hereby granted, provided that the above
11
+ * copyright notice and this permission notice appear in all copies.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20
+ */
21
+/*
22
+ *
23
+ *History:
24
+ *--------
25
+ *  2007-07-13  splitted from fastlock.h (andrei)
26
+ */
27
+
28
+
29
+#ifndef _sched_yield_h
30
+#define _sched_yield_h
31
+
32
+#ifdef HAVE_SCHED_YIELD
33
+#include <sched.h>
34
+#else
35
+#include <unistd.h>
36
+	/* fake sched_yield */
37
+#ifndef sched_yield()
38
+	#define sched_yield()	sleep(0)
39
+#endif
40
+#endif
41
+
42
+#endif /* _sched_yield_h */
... ...
@@ -59,17 +59,7 @@
59 59
 #include "mem/shm_mem.h"
60 60
 #endif
61 61
 #include "locking.h"
62
-
63
-#ifdef HAVE_SCHED_YIELD
64
-#include <sched.h>
65
-#else
66
-#include <unistd.h>
67
-	/* fake sched_yield */
68
-#ifndef sched_yield()
69
-#define sched_yield()	sleep(0)
70
-#endif
71
-#endif
72
-
62
+#include "sched_yield.h"
73 63
 
74 64
 
75 65
 /* how often will the timer handler be called (in ticks) */