| 1 | /* | 
 
 
 
 
 | 2 | Copyright (c) 2011-2016  mingw-w64 project | 
 
 
 
 
 | 3 |  | 
 
 
 
 
 | 4 | Permission is hereby granted, free of charge, to any person obtaining a | 
 
 
 
 
 | 5 | copy of this software and associated documentation files (the "Software"), | 
 
 
 
 
 | 6 | to deal in the Software without restriction, including without limitation | 
 
 
 
 
 | 7 | the rights to use, copy, modify, merge, publish, distribute, sublicense, | 
 
 
 
 
 | 8 | and/or sell copies of the Software, and to permit persons to whom the | 
 
 
 
 
 | 9 | Software is furnished to do so, subject to the following conditions: | 
 
 
 
 
 | 10 |  | 
 
 
 
 
 | 11 | The above copyright notice and this permission notice shall be included in | 
 
 
 
 
 | 12 | all copies or substantial portions of the Software. | 
 
 
 
 
 | 13 |  | 
 
 
 
 
 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
 
 
 
 
 | 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
 
 
 
 
 | 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 
 
 
 
 
 | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
 
 
 
 
 | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 
 
 
 
 
 | 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 
 
 
 
 
 | 20 | DEALINGS IN THE SOFTWARE. | 
 
 
 
 
 | 21 | */ | 
 
 
 
 
 | 22 |  | 
 
 
 
 
 | 23 | #include <stddef.h> | 
 
 
 
 
 | 24 | #include <errno.h> | 
 
 
 
 
 | 25 | #include <sys/types.h> | 
 
 
 
 
 | 26 |  | 
 
 
 
 
 | 27 | #include <process.h> | 
 
 
 
 
 | 28 | #include <limits.h> | 
 
 
 
 
 | 29 | #include <signal.h> | 
 
 
 
 
 | 30 |  | 
 
 
 
 
 | 31 | #include <sys/timeb.h> | 
 
 
 
 
 | 32 |  | 
 
 
 
 
 | 33 | #ifndef WIN_PTHREADS_SCHED_H | 
 
 
 
 
 | 34 | #define WIN_PTHREADS_SCHED_H | 
 
 
 
 
 | 35 |  | 
 
 
 
 
 | 36 | #ifndef SCHED_OTHER | 
 
 
 
 
 | 37 | /* Some POSIX realtime extensions, mostly stubbed */ | 
 
 
 
 
 | 38 | #define SCHED_OTHER     0 | 
 
 
 
 
 | 39 | #define SCHED_FIFO      1 | 
 
 
 
 
 | 40 | #define SCHED_RR        2 | 
 
 
 
 
 | 41 | #define SCHED_MIN       SCHED_OTHER | 
 
 
 
 
 | 42 | #define SCHED_MAX       SCHED_RR | 
 
 
 
 
 | 43 |  | 
 
 
 
 
 | 44 | struct sched_param { | 
 
 
 
 
 | 45 | int sched_priority; | 
 
 
 
 
 | 46 | }; | 
 
 
 
 
 | 47 |  | 
 
 
 
 
 | 48 | #ifdef __cplusplus | 
 
 
 
 
 | 49 | extern "C" { | 
 
 
 
 
 | 50 | #endif | 
 
 
 
 
 | 51 |  | 
 
 
 
 
 | 52 | #if defined DLL_EXPORT && !defined (WINPTHREAD_EXPORT_ALL_DEBUG) | 
 
 
 
 
 | 53 | #ifdef IN_WINPTHREAD | 
 
 
 
 
 | 54 | #define WINPTHREAD_SCHED_API __declspec(dllexport) | 
 
 
 
 
 | 55 | #else | 
 
 
 
 
 | 56 | #define WINPTHREAD_SCHED_API __declspec(dllimport) | 
 
 
 
 
 | 57 | #endif | 
 
 
 
 
 | 58 | #else | 
 
 
 
 
 | 59 | #define WINPTHREAD_SCHED_API | 
 
 
 
 
 | 60 | #endif | 
 
 
 
 
 | 61 |  | 
 
 
 
 
 | 62 | int WINPTHREAD_SCHED_API sched_yield(void); | 
 
 
 
 
 | 63 | int WINPTHREAD_SCHED_API sched_get_priority_min(int pol); | 
 
 
 
 
 | 64 | int WINPTHREAD_SCHED_API sched_get_priority_max(int pol); | 
 
 
 
 
 | 65 | int WINPTHREAD_SCHED_API sched_getscheduler(pid_t pid); | 
 
 
 
 
 | 66 | int WINPTHREAD_SCHED_API sched_setscheduler(pid_t pid, int pol, const struct sched_param *param); | 
 
 
 
 
 | 67 |  | 
 
 
 
 
 | 68 | #ifdef __cplusplus | 
 
 
 
 
 | 69 | } | 
 
 
 
 
 | 70 | #endif | 
 
 
 
 
 | 71 |  | 
 
 
 
 
 | 72 | #endif | 
 
 
 
 
 | 73 |  | 
 
 
 
 
 | 74 | #ifndef sched_rr_get_interval | 
 
 
 
 
 | 75 | #define sched_rr_get_interval(_p, _i) \ | 
 
 
 
 
 | 76 | ( errno = ENOTSUP, (int) -1 ) | 
 
 
 
 
 | 77 | #endif | 
 
 
 
 
 | 78 |  | 
 
 
 
 
 | 79 | #endif /* WIN_PTHREADS_SCHED_H */ |