Changed delaying in blocks of 25 milliseconds to sing a cond_timedwait.