thread loops: prevent from 100% cpu usage?



Hi,

my cpu uses 100% of the power due to a loop in a thread I use. How can I
prevent from that? (The loop is waiting for a digital-I/O signal from an
external device.) I tried g_thread_yield() but it doesn't seem to have
any effect. In the manual it says:

This function is often used as a method to make busy wait less evil.
But in most cases, you will encounter, there are better methods to do
that. So in general you shouldn't use that function. 

Thank You!
Felix



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]