sched.c 741 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #include <sched.h>
  10. int sched_yield(void)
  11. {
  12. rt_thread_yield();
  13. return 0;
  14. }
  15. RTM_EXPORT(sched_yield);
  16. int sched_get_priority_min(int policy)
  17. {
  18. if (policy != SCHED_FIFO && policy != SCHED_RR)
  19. return EINVAL;
  20. return 0;
  21. }
  22. RTM_EXPORT(sched_get_priority_min);
  23. int sched_get_priority_max(int policy)
  24. {
  25. if (policy != SCHED_FIFO && policy != SCHED_RR)
  26. return EINVAL;
  27. return RT_THREAD_PRIORITY_MAX - 1;
  28. }
  29. RTM_EXPORT(sched_get_priority_max);
  30. int sched_setscheduler(pid_t pid, int policy)
  31. {
  32. return EOPNOTSUPP;
  33. }
  34. RTM_EXPORT(sched_setscheduler);