chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Building pthreads egg on MacOS


From: Lassi Kortela
Subject: Building pthreads egg on MacOS
Date: Wed, 25 Aug 2021 19:38:48 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

`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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]