summaryrefslogtreecommitdiffstats
path: root/osdep/win32
Commit message (Collapse)AuthorAgeFilesLines
* win32: pthread: don't play dirty tricks for mutex initwm42015-07-272-28/+10
| | | | | | | | | | | | | | | | | | | | We used double-checked locking on pthread_mutex_t.requires_init in order to lazily initialize static mutexes (since CRITICAL_SECTION has no native way to do this). This was kind of unclean: we relied on MSVC semantics for volatile (which apparently means all accesses are weakly atomic), which is not such a good idea since mpv can't even be compiled with MSVC. Since it's too much of a pain to get weak atomics, just use INIT_ONCE for initializing the CRITICAL_SECTION. Microsoft most likely implemented this in an extremely efficient way. Essentially, it provides a mechanism for correct double-checked locking without having to deal with the tricky details. We still use an extra flag to avoid calling it at all for normal locks. (To get weak atomics, we could have used stdatomic.h, which modern MinGW provides just fine. But I don't want this wrapper depend on MinGW specifics if possible.)
* win32: add native wrappers for pthread functionswm42015-01-013-0/+380
Off by default, use --enable-win32-internal-pthreads . This probably still needs a lot more testing. It also won't work on Windows XP.