sched_yield.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef _sched_yield_h
  29. #define _sched_yield_h
  30. #ifdef HAVE_SCHED_YIELD
  31. #include <sched.h>
  32. #else
  33. #include <unistd.h>
  34. /* fake sched_yield */
  35. #ifndef sched_yield()
  36. #define sched_yield() sleep(0)
  37. #endif
  38. #endif
  39. #endif /* _sched_yield_h */