Only wake up thread if necessary

Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>