pthread_create warning on android

六眼飞鱼酱① 提交于 2019-12-05 12:23:30

When you create a thread with a scheduling policy attribute, you're requesting that a specific scheduling policy should be set (http://man7.org/linux/man-pages/man3/pthread_attr_getschedpolicy.3.html). The policy you're setting, SCHED_FIFO, is a real-time policy according to http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html. Setting the scheduling policy to a real-time policy requires the CAP_SYS_NICE capability according to http://man7.org/linux/man-pages/man7/capabilities.7.html. Therefore, the pthread_create call will fail unless you have that capability.

To solve the problem, either drop the scheduler attribute (and live with the default scheduling), or ensure that your process is started with the correct capabilities (e.g. by starting it as root and dropping all privileges except for CAP_SYS_NICE).

This error means, that the process trying to create the thread hasn't the appropriate privileges to set the scheduling priorty as specified.

Whether or not you could ignore this warning strongly depends on how the program and its integration in the system depends on the scheduling priorities set for the involved programs/modules/components of the system.

For details on how to set scheduling priorities you might like to read this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!