Multithreaded C++ plugin stops Rhino dialogs from working

I’m experiencing the following strange problem when developing a C++ plugin which makes use of a worker thread for background computations. As soon as I load this plugin, most dialogs in Rhino stop working, they simply won’t open anymore (e.g. the options dialog, all viewport dialogs, dialogs of commands). Debugging my own plugin, I found out that DoModal of the dialogs fails with return code -1. Does anyone have an idea what the underlying problem could be?
I’m using the boost thread library. If I remove all threading code from the plugin but still include the boost headers e.g. #include <boost/thread/mutex.hpp> the problem persists. Any ideas greatly appreciated.

Hi Alexander,

If you build a Debug build, you should be able to debug into your dialog’s DoModal() function. Does this provide anything useful?

– Dale

Hi Dale,

many thanks for your feedback, I will try to step into DoModal() and see what happens. In the meanwhile I have also found a workaround: I’m using OpenMP’s locking functions instead of boost:thread. There must be a more general problem using boost::thread with Rhino C++ plugins, I have generated a new Rhino plugin from scratch, as soon as I include <boost/thread/thread.hpp> the problem mentioned above occurs.


If you Google “boost:thread MFC”, you should find some information on the problem.

Dale, many thanks for your hint! I had searched on Google, but not regarding MFC. Thanks again, Alex.