Suppose, if we have a choice to make between wait_until
and select(timveval)
, then which one is better? Do anyone has performance benefit over the other or is it implementation defined?
Why this question?
Was trying to solve this problem: Android: C++ thread not waking up if screen-locked or in background. Works fine when app is in use
To summarise, a thread containing std::condition_variable::wait_until
is Not waking up when an Android device is locked. This is happening probably due to CPU going for sleep. If I replace it with socket
> select
> timeval (wait)
, as mentioned in select man page, then the situation is little better, where the thread wakes up "sometimes". As of now, none of them solve the problem.