... | ... |
@@ -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 @@ |
1 |
+/* |
|
2 |
+ * sched_yield wrapper |
|
3 |
+ * |
|
4 |
+ * $Id$ |
|
5 |
+ * |
|
6 |
+ * |
|
7 |
+ * |
|
8 |
+ * Copyright (C) 2001-2003 FhG Fokus |
|
9 |
+ * |
|
10 |
+ * Permission to use, copy, modify, and distribute this software for any |
|
11 |
+ * purpose with or without fee is hereby granted, provided that the above |
|
12 |
+ * copyright notice and this permission notice appear in all copies. |
|
13 |
+ * |
|
14 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
15 |
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
16 |
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
17 |
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
18 |
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
19 |
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
20 |
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
21 |
+ */ |
|
22 |
+/* |
|
23 |
+ * |
|
24 |
+ *History: |
|
25 |
+ *-------- |
|
26 |
+ * 2007-07-13 splitted from fastlock.h (andrei) |
|
27 |
+ */ |
|
28 |
+ |
|
29 |
+ |
|
30 |
+#ifndef _sched_yield_h |
|
31 |
+#define _sched_yield_h |
|
32 |
+ |
|
33 |
+#ifdef HAVE_SCHED_YIELD |
|
34 |
+#include <sched.h> |
|
35 |
+#else |
|
36 |
+#include <unistd.h> |
|
37 |
+ /* fake sched_yield */ |
|
38 |
+#ifndef sched_yield() |
|
39 |
+ #define sched_yield() sleep(0) |
|
40 |
+#endif |
|
41 |
+#endif |
|
42 |
+ |
|
43 |
+#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) */ |