fix infinite loop when running on 2 CPU cores

Test:
[boisver1@cp2028-mp2 robustness-tests]$ ./test-2-cores.sh
PASS

Link: https://github.com/sebhtml/ray/issues/221
Link: https://github.com/sebhtml/ray/commit/d50a972c81b1ca0c9160648ad3053be8319f85f5
Reported-by: Bastian Hornung <bastian.hornung@wur.nl>
Signed-off-by: Sébastien Boisvert <sebastien.boisvert.3@ulaval.ca>