+#ifdef DEBUG_YIELD
+#include <sched.h>
+
+#define YIELD_READ (1 << 0)
+#define YIELD_WRITE (1 << 1)
+
+extern int yield_active;
+
+static inline void debug_yield_read(void)
+{
+ if (yield_active & YIELD_READ)
+ sched_yield();
+}
+
+static inline void debug_yield_write(void)
+{
+ if (yield_active & YIELD_WRITE)
+ sched_yield();
+}
+#else
+static inline void debug_yield_read(void)
+{
+}
+
+static inline void debug_yield_write(void)
+{
+}
+#endif
+