Differences From Artifact [2393ddfd78]:
- File src/platform/posix/thread.m — part of check-in [0b6bf65d2e] at 2021-01-13 23:08:19 on branch trunk — Pass NULL if pthread attributes are not available (user: js, size: 4277) [annotate] [blame] [check-ins using]
To Artifact [5ab8be6ac9]:
- File
src/platform/posix/thread.m
— part of check-in
[ab0f2cc617]
at
2021-01-14 01:11:21
on branch trunk
— Don't use pthread priorities on HP-UX
Creating a thread with priority 0 (documented to be the default) results
in pthread_create() returning EPERM. This means that priorities are
effectively not usable by normal users. (user: js, size: 4421) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
123 124 125 126 127 128 129 130 131 132 133 134 | return error; } @try { struct thread_ctx *ctx; if (attr != NULL && POSIXAttrAvailable) { struct sched_param param; if (attr->priority < -1 || attr->priority > 1) return EINVAL; | > > > | | > > > > > | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | return error; } @try { struct thread_ctx *ctx; if (attr != NULL && POSIXAttrAvailable) { #ifndef OF_HPUX struct sched_param param; #endif if (attr->priority < -1 || attr->priority > 1) return EINVAL; #ifndef OF_HPUX # ifdef HAVE_PTHREAD_ATTR_SETINHERITSCHED if ((error = pthread_attr_setinheritsched(&POSIXAttr, PTHREAD_EXPLICIT_SCHED)) != 0) return error; # endif if ((error = pthread_attr_getschedparam(&POSIXAttr, ¶m)) != 0) return error; if (attr->priority < 0) { param.sched_priority = minPrio + (1.0f + attr->priority) * (normalPrio - minPrio); } else param.sched_priority = normalPrio + attr->priority * (maxPrio - normalPrio); if ((error = pthread_attr_setschedparam(&POSIXAttr, ¶m)) != 0) return error; #endif if (attr->stackSize > 0) { if ((error = pthread_attr_setstacksize( &POSIXAttr, attr->stackSize)) != 0) return error; } } |
︙ | ︙ |