How do you print to console in a Multi-Threaded MEX Function?
问题 I'm writing a simple producer consumer MEX function which uses the Boost library. I have manged to get the following program to work without any issues. #include "mex.h" #include <boost/thread/thread.hpp> #include <boost/lockfree/spsc_queue.hpp> #include <iostream> #include <boost/atomic.hpp> int producer_count = 0; boost::atomic_int consumer_count (0); boost::lockfree::spsc_queue<int, boost::lockfree::capacity<1024> > spsc_queue; const int iterations = 10000000; void producer() { for (int i