diff --git a/stream/cache2.c b/stream/cache2.c index 7bdeabd9e3..e5756e07be 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -439,32 +439,30 @@ err_out: return res; } -#if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__) -} -#ifdef PTHREAD_CACHE -static void *ThreadProc( void *s ){ -#else -static void ThreadProc( void *s ){ -#endif -#endif - +#if !defined(__MINGW32__) && !defined(PTHREAD_CACHE) && !defined(__OS2__) #ifdef CONFIG_GUI use_gui = 0; // mp_msg may not use gui stuff in forked code #endif -// cache thread mainloop: signal(SIGTERM,exit_sighandler); // kill signal(SIGUSR1, dummy_sighandler); // wakeup cache_mainloop(s); -#if defined(__MINGW32__) || defined(__OS2__) - _endthread(); -#elif defined(PTHREAD_CACHE) - return NULL; -#else // make sure forked code never leaves this function exit(0); #endif } +#ifdef PTHREAD_CACHE +static void *ThreadProc( void *s ){ + cache_mainloop(s); + return NULL; +} +#elif defined(__MINGW32__) || defined(__OS2__) +static void ThreadProc( void *s ){ + cache_mainloop(s); + _endthread(); +} +#endif + int cache_stream_fill_buffer(stream_t *s){ int len; if(s->eof){ s->buf_pos=s->buf_len=0; return 0; }