This is the second attempt to fix the issue. This time I just used a mutex to avoid the issue and kept almost all the code in its original form. I didn't use the concurrent queue mutex to avoid polluting its API and because I'm not sure it would be enough. Hence, if at the end the concurrent queue mutex is not going to be used I believe that we should replace that queue for a regular std::deque.
Fix #89
This is the second attempt to fix the issue. This time I just used a mutex to avoid the issue and kept almost all the code in its original form. I didn't use the concurrent queue mutex to avoid polluting its API and because I'm not sure it would be enough. Hence, if at the end the concurrent queue mutex is not going to be used I believe that we should replace that queue for a regular std::deque.