Singleton: Difference between revisions

Content added Content deleted
(Added non-thread-safe C++ version, subcategorized ObjC and C++ examples.)
(→‎Thread-safe: forgot to close the handle)
Line 23: Line 23:
// Release our mutex so that other application threads can use this function
// Release our mutex so that other application threads can use this function
ReleaseMutex( hMutex );
ReleaseMutex( hMutex );

// Free the handle
CloseHandle( hMutex );


// Return a pointer to our mutex instance.
// Return a pointer to our mutex instance.