LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   What type of mutex which when acquired doesn't hog CPU resources. (https://www.linuxquestions.org/questions/programming-9/what-type-of-mutex-which-when-acquired-doesnt-hog-cpu-resources-4175431588/)

chaits3 10-10-2012 11:58 PM

What type of mutex which when acquired doesn't hog CPU resources.
 
For my application I am currently using a ACE Thread Semaphore which is acquired for 2 minutes and after a timer expiry i gets released. I see that this is unnecessarily hogging CPU resources. Could any1 please recommend other way to do the same thing without hogging CPU resources when acquired.
Also, is there some way in which i spawn a thread say in idle mode when it is not doing anything until signaled, with an optimized CPU resource utilization.

pan64 10-12-2012 02:29 AM

I think the semaphore itself is not able to do that.
Idle threads should use sleep, yield or probably join.


All times are GMT -5. The time now is 10:27 PM.