pthread supports static initialization of pthread_mutex_t using PTHREAD_MUTEX_INITIALIZER.
Is it possible to achieve a similar static mechanism for mutex initialization using Windows mutex?
pthread supports static initialization of pthread_mutex_t using PTHREAD_MUTEX_INITIALIZER.
Is it possible to achieve a similar static mechanism for mutex initialization using Windows mutex?
No, since Windows mutex are handles, they must be initialized with CreateMutex()
.
Note that the static initialization of pthread_mutex_t using PTHREAD_MUTEX_INITIALIZER
is not a real init, it will be done internally at the first call to pthread_mutex_lock()
or pthread_mutex_trylock()