diff -NpuBr -Xexclude.txt main/configure sherpya/configure --- main/configure 2008-07-17 19:52:46.062500000 +0200 +++ sherpya/configure 2008-07-17 19:54:45.390625000 +0200 @@ -3062,7 +3062,20 @@ if test "$_pthreads" = auto ; then cat > $TMPC << EOF #include void* func(void *arg) { return arg; } -int main(void) { pthread_t tid; return pthread_create (&tid, 0, func, 0) == 0 ? 0 : 1; } +int main(void) { +pthread_t tid; +int res = 0; +#ifdef PTW32_STATIC_LIB + pthread_win32_process_attach_np(); + pthread_win32_thread_attach_np(); +#endif +res = pthread_create (&tid, 0, func, 0) == 0 ? 0 : 1; +#ifdef PTW32_STATIC_LIB + pthread_win32_thread_detach_np(); + pthread_win32_process_detach_np(); +#endif +return res; +} EOF _pthreads=no if ! hpux ; then @@ -3071,6 +3084,12 @@ if ! hpux ; then cc_check $_ld_tmp && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && break done fi +# static pthreads on mingw32 +if test "$_pthreads" = no && mingw32 ; then + _ld_tmp="-lpthreadGC2 -lws2_32" + cc_check $_ld_tmp -DPTW32_STATIC_LIB && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && CFLAGS="$CFLAGS -DPTW32_STATIC_LIB" +fi + fi if test "$_pthreads" = yes ; then _res_comment="using $_ld_pthread" diff -NpuBr -Xexclude.txt main/mencoder.c sherpya/mencoder.c --- main/mencoder.c 2008-06-16 10:58:56.578125000 +0200 +++ sherpya/mencoder.c 2008-07-17 19:54:45.406250000 +0200 @@ -363,6 +363,14 @@ static muxer_t* muxer=NULL; extern void print_wave_header(WAVEFORMATEX *h, int verbose_level); +#ifdef PTW32_STATIC_LIB +static void detach_ptw32(void) +{ + pthread_win32_thread_detach_np(); + pthread_win32_process_detach_np(); +} +#endif + int main(int argc,char* argv[]){ stream_t* stream=NULL; @@ -412,6 +420,12 @@ audio_encoder_t *aencoder = NULL; user_correct_pts = 0; +#ifdef PTW32_STATIC_LIB + pthread_win32_process_attach_np(); + pthread_win32_thread_attach_np(); + atexit(detach_ptw32); +#endif + mp_msg_init(); // Create the config context and register the options diff -NpuBr -Xexclude.txt main/mplayer.c sherpya/mplayer.c --- main/mplayer.c 2008-06-18 03:32:35.562500000 +0200 +++ sherpya/mplayer.c 2008-07-17 19:54:45.421875000 +0200 @@ -2537,6 +2537,14 @@ static int seek(MPContext *mpctx, double return 0; } +#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 @@ -2556,6 +2564,12 @@ int i; int gui_no_filename=0; +#ifdef PTW32_STATIC_LIB + pthread_win32_process_attach_np(); + pthread_win32_thread_attach_np(); + atexit(detach_ptw32); +#endif + srand((int) time(NULL)); InitTimer();