1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-11 08:37:59 +00:00

win32: drop hacks for possibly broken static pthreads-win32 linking

We now use threads and other pthread API a lot, and not always we use it
from threads created with pthread_create() (or the main thread). As I
understand, with static linking we would have to use
pthread_win32_thread_attach/detach_np() every time we enter or leave a
foreign thread. We don't do this, and it's not feasible either, so it's
just broken.

This still should work with dynamic pthreads-win32. The MinGW pthread
implementation should be unaffected from all of this.
This commit is contained in:
wm4 2015-01-11 02:23:02 +01:00
parent e96c08ecb5
commit 3b091995a0
3 changed files with 0 additions and 19 deletions

View File

@ -274,14 +274,6 @@ static bool handle_help_options(struct MPContext *mpctx)
return opt_exit;
}
#ifdef PTW32_STATIC_LIB
static void detach_ptw32(void)
{
pthread_win32_thread_detach_np();
pthread_win32_process_detach_np();
}
#endif
static void osdep_preinit(int *p_argc, char ***p_argv)
{
char *enable_talloc = getenv("MPV_LEAK_REPORT");
@ -295,12 +287,6 @@ static void osdep_preinit(int *p_argc, char ***p_argv)
mp_get_converted_argv(p_argc, p_argv);
#endif
#ifdef PTW32_STATIC_LIB
pthread_win32_process_attach_np();
pthread_win32_thread_attach_np();
atexit(detach_ptw32);
#endif
#if defined(__MINGW32__) || defined(__CYGWIN__)
// stop Windows from showing all kinds of annoying error dialogs
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);

View File

@ -33,7 +33,6 @@ def check_pthreads(ctx, dependency_identifier):
'freebsd': '-D_THREAD_SAFE',
'netbsd': '-D_THREAD_SAFE',
'openbsd': '-D_THREAD_SAFE',
'win32': '-DPTW32_STATIC_LIB',
}.get(ctx.env.DEST_OS, '')
libs = ['pthreadGC2', 'pthread']
checkfn = check_cc(fragment=pthreads_program, cflags=platform_cflags)

View File

@ -2,9 +2,5 @@
static void *func(void *arg) { return arg; }
int main(void) {
pthread_t tid;
#ifdef PTW32_STATIC_LIB
pthread_win32_process_attach_np();
pthread_win32_thread_attach_np();
#endif
return pthread_create (&tid, 0, func, 0) != 0;
}