added the possibility to not use the condition variable (maybe cond vars are not safe in real time)