开发者

increment the priority of a thread in Linux

开发者 https://www.devze.com 2022-12-14 23:49 出处:网络
I am reading data from a HID device using hiddev , there is a dedicated thread to read off of it, but it seems that thread is dropping some packets. I can see the packets in the kern开发者_运维百科el

I am reading data from a HID device using hiddev , there is a dedicated thread to read off of it, but it seems that thread is dropping some packets. I can see the packets in the kern开发者_运维百科el buffers(usbmon) but some of them don't reach user space. The reads inside the reading thread mostly finish on time(~4ms). I think the process is not getting enough processor time, thus the kernel fills its queue and drops the packets, by the time the process gets to read them it only finds tails or nothing at all?!

Any sugestions I have been thinking in increasing the proiority of thread?! what is the appropiate function?

Thanks guys


Use pthread_setschedprio() from librt.

0

精彩评论

暂无评论...
验证码 换一张
取 消