fixed a critical bug in the message queue

Signed-off-by: Sébastien Boisvert <sebastien.boisvert.3@ulaval.ca>
simplified the waiting states

Signed-off-by: Sébastien Boisvert <sebastien.boisvert.3@ulaval.ca>