Differences From Artifact [5bca66cb41]:
- File src/threading_pthread.m — part of check-in [839745fa85] at 2018-06-17 18:23:51 on branch trunk — configure: Check for pthread_attr_getschedpolicy() (user: js, size: 6267) [annotate] [blame] [check-ins using]
To Artifact [b133b4ffce]:
- File
src/threading_pthread.m
— part of check-in
[cdd30dfb53]
at
2018-10-20 17:48:40
on branch trunk
— threading_pthread.m: More fault tolerant init
This fixes NetBSD 8. (user: js, size: 6343) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
23 24 25 26 27 28 29 | #import "macros.h" #ifdef OF_HAIKU # include <kernel/OS.h> #endif | | > > | | < | | | | < > > | > > | > > | > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #import "macros.h" #ifdef OF_HAIKU # include <kernel/OS.h> #endif static int minPrio = 0, maxPrio = 0, normalPrio = 0; struct thread_ctx { void (*function)(id object); id object; }; /* * This is done here to make sure this is done as early as possible in the main * thread. */ OF_CONSTRUCTOR() { pthread_attr_t pattr; if (pthread_attr_init(&pattr) == 0) { #ifdef HAVE_PTHREAD_ATTR_GETSCHEDPOLICY int policy; #endif struct sched_param param; #ifdef HAVE_PTHREAD_ATTR_GETSCHEDPOLICY if (pthread_attr_getschedpolicy(&pattr, &policy) == 0) { minPrio = sched_get_priority_min(policy); maxPrio = sched_get_priority_max(policy); if (minPrio == -1 || maxPrio == -1) minPrio = maxPrio = 0; } if (pthread_attr_getschedparam(&pattr, ¶m) != 0) normalPrio = param.sched_priority; else minPrio = maxPrio = 0; pthread_attr_destroy(&pattr); #endif } } static void * function_wrapper(void *data) { struct thread_ctx *ctx = data; |
︙ | ︙ |