Add multithreading functions and shutdown to the C API.  Patch by Moritz
Maxeiner.