[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building pthreads egg on MacOS
From: |
Jörg F. Wittenberger |
Subject: |
Re: Building pthreads egg on MacOS |
Date: |
Thu, 26 Aug 2021 19:49:55 +0200 |
Hi Lassi,
that's a good question!
There has been only so much consideration as to why raise the priority
in the first place: there is exactly one Chicken thread, hence it's a
precious resource. Let's raise priority.
In other words: I'd expect little harm without it. Just
inconsistency. :-/
Darwin being the culprit here, IMHO: in this simplest solution feels
appealing to me.
Anything I'm missing?
Am Wed, 25 Aug 2021 19:38:48 +0300
schrieb Lassi Kortela <lassi@lassi.io>:
> `chicken-install pthreads` fails to compile the following C code on
> Mac:
>
> void
> C_pthread_pre_init(void *intres)
> {
> .
> .
> .
> if(pthread_setschedprio(pthread_self(),
> sched_get_priority_max(sched_getscheduler(0)))) {
> fprintf(stderr, "Failed to raise main thread priority.\n");
> }
> }
>
> because Darwin is missing pthread_setschedprio() and
> sched_getscheduler() -- even though these are POSIX standard
> functions.
>
> What should we do?
>
> https://stackoverflow.com/questions/12056491/how-to-set-thread-priority-pthreads-on-mac-os
>
> says "You can only set the priority of a thread when you create it
> using pthread_setschedparam()." The current thread (pthread_self())
> has already been created so we probably can't use
> pthread_setschedparam() on it.
>
> The simplest option would be an #ifdef to comment out the above lines
> of code on Darwin.