Adding missing mutex locks for D and C++ and minor improvement

Hi,
please find attached small improvements for flint:
* Adding two missing lock types for the D implementation and one for the C++ part.
* Changing the assert(0) into an exception that get's caught in main so that one has a better error message.

Best regards, 
Felix