diff options
author | Diogo Franco <diogomfranco@gmail.com> | 2011-03-27 12:38:01 -0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-03-30 14:50:47 +0300 |
commit | 5c731e2ea669bbc732e51dc95c1ec68cc41050e6 (patch) | |
tree | 44f2f7560c6d277493777f1b9638f0c66e30fe32 /mplayer.c | |
parent | 7131fceb0b80c462604e65fe1869db6e14791b4e (diff) | |
download | mpv-5c731e2ea669bbc732e51dc95c1ec68cc41050e6.tar.bz2 mpv-5c731e2ea669bbc732e51dc95c1ec68cc41050e6.tar.xz |
configure, Windows: support static pthreads on Windows
Windows pthreads requires certain functions to be called to initialize
itself. It can do that through DllMain but no such luck when linked
statically; mplayer needs to call the initialization explicitly.
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -3889,10 +3889,23 @@ if (HAVE_CMOV) #endif /* ARCH_X86 */ } +#ifdef PTW32_STATIC_LIB +static void detach_ptw32(void) +{ + pthread_win32_thread_detach_np(); + pthread_win32_process_detach_np(); +} +#endif + /* This preprocessor directive is a hack to generate a mplayer-nomain.o object * file for some tools to link against. */ #ifndef DISABLE_MAIN int main(int argc,char* argv[]){ +#ifdef PTW32_STATIC_LIB + pthread_win32_process_attach_np(); + pthread_win32_thread_attach_np(); + atexit(detach_ptw32); +#endif if (argc > 1 && !strcmp(argv[1], "-leak-report")) talloc_enable_leak_report(); |