mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-20 12:34:18 -04:00
Lower the priority of the thread so forked-daapd may still respond
during file scan on low power devices
This commit is contained in:
parent
2545aedc2a
commit
d2d85b29f4
@ -1074,8 +1074,20 @@ bulk_scan(int flags)
|
|||||||
static void *
|
static void *
|
||||||
filescanner(void *arg)
|
filescanner(void *arg)
|
||||||
{
|
{
|
||||||
|
struct sched_param param;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* Lower the priority of the thread so forked-daapd may still respond
|
||||||
|
* during file scan on low power devices. Param must be 0 for the SCHED_BATCH
|
||||||
|
* policy.
|
||||||
|
*/
|
||||||
|
memset(¶m, 0, sizeof(struct sched_param));
|
||||||
|
ret = pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
DPRINTF(E_LOG, L_SCAN, "Warning: Could not set thread priority to SCHED_BATCH\n");
|
||||||
|
}
|
||||||
|
|
||||||
ret = db_perthread_init();
|
ret = db_perthread_init();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user