Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12 роки тому
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * piHiPri:
  3. * Simple way to get your program running at high priority
  4. * with realtime schedulling.
  5. *
  6. * Copyright (c) 2012 Gordon Henderson
  7. ***********************************************************************
  8. * This file is part of wiringPi:
  9. * https://projects.drogon.net/raspberry-pi/wiringpi/
  10. *
  11. * wiringPi is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Lesser General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * wiringPi is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public
  22. * License along with wiringPi.
  23. * If not, see <http://www.gnu.org/licenses/>.
  24. ***********************************************************************
  25. */
  26. #include <sched.h>
  27. #include <string.h>
  28. #include "wiringPi.h"
  29. /*
  30. * piHiPri:
  31. * Attempt to set a high priority schedulling for the running program
  32. *********************************************************************************
  33. */
  34. int piHiPri (int pri)
  35. {
  36. struct sched_param sched ;
  37. memset (&sched, 0, sizeof(sched)) ;
  38. if (pri > sched_get_priority_max (SCHED_RR))
  39. pri = sched_get_priority_max (SCHED_RR) ;
  40. sched.sched_priority = pri ;
  41. return sched_setscheduler (0, SCHED_RR, &sched) ;
  42. }