Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make install cc -g -ggdb -Wall -O2 -c src/pixie-threads.c -o tmp/pixie-threads.o src/pixie-threads.c:51:5: error: call to undeclared function 'pthread_setschedprio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 51 | pthread_setschedprio(thread, max_prio_for_policy); | ^ src/pixie-threads.c:51:5: note: did you mean 'pthread_setschedparam'? /data/data/com.termux/files/usr/include/pthread.h:348:5: note: 'pthread_setschedparam' declared here 348 | int pthread_setschedparam(pthread_t #762

Open
Qs2255 opened this issue Feb 13, 2024 · 1 comment

Comments

@Qs2255
Copy link

Qs2255 commented Feb 13, 2024

make install
cc -g -ggdb -Wall -O2 -c src/pixie-threads.c -o tmp/pixie-threads.o
src/pixie-threads.c:51:5: error: call to undeclared function 'pthread_setschedprio'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
51 | pthread_setschedprio(thread, max_prio_for_policy);
| ^
src/pixie-threads.c:51:5: note: did you mean 'pthread_setschedparam'?
/data/data/com.termux/files/usr/include/pthread.h:348:5: note: 'pthread_setschedparam' declared here
348 | int pthread_setschedparam(pthread_t __pthread, int __policy, const struct sched_param* _Nonnull __param);
| ^
1 error generated.
make: *** [Makefile:116: tmp/pixie-threads.o] Error 1

@johnzxlin
Copy link

Edit your pixie thread.c file in src folder

Replace this

pthread_t thread = pthread_self();
pthread_attr_t thAttr;
int policy = 0;
int max_prio_for_policy = 0;

pthread_attr_init(&thAttr);
pthread_attr_getschedpolicy(&thAttr, &policy);
max_prio_for_policy = sched_get_priority_max(policy);


pthread_setschedprio(thread, max_prio_for_policy);
pthread_attr_destroy(&thAttr);
return;

TO THIS (BELOW)

int policy;
struct sched_param param;

pthread_getschedparam(pthread_self(), &policy, &param);
param.sched_priority = sched_get_priority_max(policy);
pthread_setschedparam(pthread_self(), policy, &param);

return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants