summaryrefslogtreecommitdiffstats
path: root/osdep/win32
Commit message (Collapse)AuthorAgeFilesLines
* win32/pthread: remove unused codeKacper Michajłow2023-11-053-529/+0
|
* ALL: use new mp_thread abstractionKacper Michajłow2023-11-051-3/+3
|
* win32/pthread: fix calculation error in pthread_cond_timedwaitsfan52023-10-211-1/+1
| | | | closes #12699
* win32/pthread: add support for pthread_mutex_trylockThomas Weißschuh2023-10-202-0/+11
|
* win32/pthread: try to fix system headers leaking throughsfan52023-10-201-0/+6
|
* win32/pthread: implement clock_gettime for high-res timer purposessfan52023-10-202-9/+31
| | | | | | | Also apply some fixes to pthread_cond_timedwait while we're at it. Note that by using GetSystemTimePreciseAsFileTime here we lose support for Windows 7. This is considered acceptable.
* Revert "win32/pthread: don't convert time through unrelated timer"sfan52023-10-201-6/+16
| | | | | | | | | | This reverts commit 318b5471a18e464cfcd1f7222da7853b7056f9fc. While it may work, changing these two functions in violation of their documented behaviour for the sake of a shortcut is a hack that will spell disaster sooner or later. This is a partial revert since the commit in question also contained a hidden bugfix where it swapped the calculation order for time_rel.
* win32/pthread: define _POSIX_TIMERS to notify they are not supportedKacper Michajłow2023-09-291-0/+2
|
* win32/pthread: don't convert time through unrelated timerKacper Michajłow2023-09-291-16/+6
| | | | Just keep it directly as mp_time for internal implementation.
* build: add meson build supportDudemanguy2021-11-141-0/+1
| | | | | | Adds support for the meson build system as well as a bit of documentation. Compatibility with the existing waf build is maintained.
* win32: Windows 10: timeBeginPeriod on demandAvi Halachmi (:avih)2021-09-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Before this commit, timeBeginPeriod(1) was set once when mpv starts, and the timers remained hi-res till mpv exits. Now we do the same as before on Windows version < 10. On Windows 10+ we now use timeBeginPeriod if needed, per timeout. To force a mode regardless of Windows version, set env MPV_HRT: - "always": the old behavior - hires timers as long as mpv runs. - "perwait": sets 1ms timer resolution if timeout <= 50ms. - "never": don't use timeBeginPeriod at all. It was observed that on Windows 10 we lose about 0.5ms accuracy of timeouts with "perwait" mode (acceptable), but otherwise it works well for continuous timeouts (one after the other) and random ones. On Windows 7 with "perwait": continous timeouts are accurate, but random timeouts (after some time without timeouts) have bad accuracy - roughly 16ms resolution instead of the requested 1ms. Windows 8 was not tested, so to err on the side of caution, we keep the legacy behavior "always" by default.
* win32: pthread: define PTHREAD_MUTEX_ERRORCHECKwm42020-03-191-0/+1
| | | | mpv uses it now. Doesn't need to do anything.
* win32: fix massive memory corruption (take 2)wm42017-08-211-3/+4
| | | | | | As pointed out by uau on IRC, the pointer to info is still used outside of the lock. An extremely small race condition window, but still a race condition.
* win32: fix massive memory corruptionwm42017-08-211-2/+6
| | | | | | | | | | The struct m_thread_info pointer is part of an array, that will be reallocated if another thread is created while the run_thread is just being called. In previous versions of this code, the pointer was stable (as long as the thread existed), so this was overlooked. Fixes #4770. I'm not sure why this triggers it so reliably, while it remained undetected otherwise.
* Universal Windows Plaform (UWP) supportPedro Pombeiro2017-06-291-0/+2
| | | | | | | | libmpv only. Some things are still missing. Heavily reworked. Signed-off-by: wm4 <wm4@nowhere>
* win32: pthread: avoid using TLS, simplify pthread_twm42017-06-152-48/+89
| | | | | | | | | | | | | | | | | Don't use __thread, which requires heavy runtime in some cases (such as MinGW-w64, at least under some configurations, forcing you to link to its pthread runtime DLL). The pthread_t struct was needed over a simple thread ID, because pthread_join() needed to access some sort of context from pthread_t. Further, pthread_exit() and pthread_detach() need the context of the current thread, for which we relied on TLS. Replace these uses by a global thread array. This includes all threads created by the thread wrapper. Hopefully the number of threads created by mpv is low (say, below 20), and threads are not that often created or destroyed. So just keeping them in an array with linear search lookup should be reasonable.
* win32: pthread: use the new thread naming APIJames Ross-Gowan2017-05-182-0/+26
| | | | | | | Windows, as of the Creators Update, finally has a sane API for giving a name to a thread that can be used by debuggers. This is similar to pthread_setname_np on Linux and some Unixes. Expose it in the pthread wrapper and use it for mpthread_set_name().
* Fix use of ISC licensewm42017-04-153-1/+34
| | | | | | | | | | The license text refers a "above copyright notice", so I guess it'd be good to actually provide such a notice. Add the license to some files that were missing it (since in theory, our Copyright file says that such files are LGPL by default). Remove the questionable remarks about the license in the client API.
* win32: pthread: use SRW locks by defaultwm42016-05-242-20/+33
| | | | | | | | | SRW locks are available since Windows Vista. They work essentially like Linux futexes. In particular, they can be statically initialized, and do not require deinitialization. This makes them ideal for implementing PTHREAD_MUTEX_INITIALIZER. We still need CRITICAL_SECTION for recursive mutexes.
* 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.