mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
core: use pthread_setschedparam across the board
I think I was trying to avoid introducing pthread as a dependency, but now we are using pthread for SGI_video_sync thread anyway. Let's remove the ifdefs. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
709f0168d9
commit
dff77aae27
2 changed files with 4 additions and 20 deletions
|
@ -23,7 +23,7 @@ required_xcb_packages = [
|
|||
# Some XCB packages are here because their versioning differs (see check below).
|
||||
required_packages = [
|
||||
'pixman-1', 'x11', 'x11-xcb', 'xcb-image', 'xcb-renderutil', 'xcb-util',
|
||||
'xext'
|
||||
'xext', 'threads',
|
||||
]
|
||||
|
||||
foreach i : required_packages
|
||||
|
@ -59,7 +59,7 @@ endif
|
|||
|
||||
if get_option('opengl')
|
||||
cflags += ['-DCONFIG_OPENGL', '-DGL_GLEXT_PROTOTYPES']
|
||||
deps += [dependency('gl', required: true), dependency('egl', required: true), dependency('threads', required:true)]
|
||||
deps += [dependency('gl', required: true), dependency('egl', required: true)]
|
||||
srcs += [ 'opengl.c' ]
|
||||
endif
|
||||
|
||||
|
@ -86,10 +86,6 @@ elif (host_system == 'freebsd' or host_system == 'netbsd' or
|
|||
cflags += ['-DHAS_KQUEUE']
|
||||
endif
|
||||
|
||||
if host_system == 'openbsd'
|
||||
deps += [dependency('threads', required: true)]
|
||||
endif
|
||||
|
||||
subdir('backend')
|
||||
|
||||
picom = executable('picom', srcs, c_args: cflags,
|
||||
|
|
16
src/picom.c
16
src/picom.c
|
@ -19,6 +19,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
@ -35,9 +36,6 @@
|
|||
#include <xcb/render.h>
|
||||
#include <xcb/sync.h>
|
||||
#include <xcb/xfixes.h>
|
||||
#ifdef __OpenBSD__
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include <ev.h>
|
||||
#include <test.h>
|
||||
|
@ -2590,14 +2588,8 @@ void set_rr_scheduling(void) {
|
|||
|
||||
int ret;
|
||||
struct sched_param param;
|
||||
|
||||
#ifndef __OpenBSD__
|
||||
ret = sched_getparam(0, ¶m);
|
||||
#else
|
||||
int old_policy;
|
||||
ret = pthread_getschedparam(pthread_self(), &old_policy, ¶m);
|
||||
#endif
|
||||
|
||||
if (ret != 0) {
|
||||
log_debug("Failed to get old scheduling priority");
|
||||
return;
|
||||
|
@ -2605,12 +2597,7 @@ void set_rr_scheduling(void) {
|
|||
|
||||
param.sched_priority = priority;
|
||||
|
||||
#ifndef __OpenBSD__
|
||||
ret = sched_setscheduler(0, SCHED_RR, ¶m);
|
||||
#else
|
||||
ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m);
|
||||
#endif
|
||||
|
||||
if (ret != 0) {
|
||||
log_info("Failed to set real-time scheduling priority to %d. Consider "
|
||||
"giving picom the CAP_SYS_NICE capability or equivalent "
|
||||
|
@ -2618,6 +2605,7 @@ void set_rr_scheduling(void) {
|
|||
priority);
|
||||
return;
|
||||
}
|
||||
|
||||
log_info("Set real-time scheduling priority to %d", priority);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue