diff options
author | Anssi Mäkinen <16635602+Mitalie@users.noreply.github.com> | 2023-08-17 06:12:05 +0300 |
---|---|---|
committer | Anssi Mäkinen <16635602+Mitalie@users.noreply.github.com> | 2023-08-17 06:12:05 +0300 |
commit | 3a57fff1e3e9f8f133eaf46f7eb0381a70a323b4 (patch) | |
tree | 1dac8ab3fad7a7d5cfd03ddc2595e2b628d4b79a /src | |
parent | f7245f66295752306ee58c1a9be0ed01b653e347 (diff) | |
download | lanes-3a57fff1e3e9f8f133eaf46f7eb0381a70a323b4.tar.gz lanes-3a57fff1e3e9f8f133eaf46f7eb0381a70a323b4.tar.bz2 lanes-3a57fff1e3e9f8f133eaf46f7eb0381a70a323b4.zip |
Prevent crash on linux as non-root
Fixes #218
Diffstat (limited to 'src')
-rw-r--r-- | src/threading.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/threading.c b/src/threading.c index 2b68503..2464d03 100644 --- a/src/threading.c +++ b/src/threading.c | |||
@@ -779,8 +779,8 @@ void THREAD_CREATE( THREAD_T* ref, THREAD_RETURN_T (*func)( void*), void* data, | |||
779 | { | 779 | { |
780 | pthread_attr_t a; | 780 | pthread_attr_t a; |
781 | bool_t const change_priority = | 781 | bool_t const change_priority = |
782 | #if defined(PLATFORM_LINUX) && defined(LINUX_SCHED_RR) | 782 | #ifdef PLATFORM_LINUX |
783 | sudo && // with sudo, even normal thread must use SCHED_RR | 783 | sudo && // only root-privileged process can change priorities |
784 | #endif | 784 | #endif |
785 | (prio != THREAD_PRIO_DEFAULT); | 785 | (prio != THREAD_PRIO_DEFAULT); |
786 | 786 | ||
@@ -887,9 +887,9 @@ void THREAD_CREATE( THREAD_T* ref, THREAD_RETURN_T (*func)( void*), void* data, | |||
887 | 887 | ||
888 | void THREAD_SET_PRIORITY( int prio) | 888 | void THREAD_SET_PRIORITY( int prio) |
889 | { | 889 | { |
890 | #if defined PLATFORM_LINUX && defined LINUX_SCHED_RR | 890 | #ifdef PLATFORM_LINUX |
891 | if( sudo) // only root-privileged process can change priorities | 891 | if( sudo) // only root-privileged process can change priorities |
892 | #endif // defined PLATFORM_LINUX && defined LINUX_SCHED_RR | 892 | #endif // PLATFORM_LINUX |
893 | { | 893 | { |
894 | struct sched_param sp; | 894 | struct sched_param sp; |
895 | // prio range [-3,+3] was checked by the caller | 895 | // prio range [-3,+3] was checked by the caller |