Alex, a named mutex on Windows will be system wide. We don't want that here.

I think you want to rather use on Windows InitializeCriticalSectionAndSpinCount() which implements a spin lock to start, and it looks then switches to a critical section (heavier) after a number of spins.

You should Initialize your object on the init of mongo_connection object and finalize on some finalization method that should follow Mongo C driver convention.