Call notify_uninit() on exceptions
Use safe ffi calls

I'm convinced by http://blog.ezyang.com/2010/07/safety-first-ffi-and-threading/ :]