[MPlayer-dev-eng] [PATCH] use pthreads for caching

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Jan 27 11:27:24 CET 2007


Hello,
On Sat, Jan 27, 2007 at 11:15:30AM +0100, Reimar D?ffinger wrote:
> On Sat, Jan 27, 2007 at 10:30:30AM +0100, A Mennucc wrote:
> > So the reason that my patch for threaded caching works is that it is
> > possible to open dialog windows from different threads.
> > 
> > possible solutions:
> > 
> > 1) make sure you do not ever ever display a dialog from the caching code
> > 2) use pthreads
> > 
> > I would suggest the 2nd  :-)
> > (as I explained in my other email, mplayer is already compiled to use
> > pthreads in linux)
> 
> 2) is not a solution to this problem it is a hack-around (or in German:
> a Würgaround).
> I think your suggestion has merits, but this problem is not one of them!
> Actually, I consider hiding a bug a point against a patch.

Except that it breaks mencoder linking, attached patch is closer to a
proper fix for that problem.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: stream/cache2.c
===================================================================
--- stream/cache2.c	(revision 22020)
+++ stream/cache2.c	(working copy)
@@ -28,6 +28,9 @@
 #include "help_mp.h"
 
 #include "stream.h"
+#ifdef HAVE_NEW_GUI
+extern int use_gui;
+#endif
 
 int stream_fill_buffer(stream_t *s);
 int stream_seek_long(stream_t *s,off_t pos);
@@ -306,6 +309,9 @@
 static DWORD WINAPI ThreadProc(void*s){
 #endif
   
+#ifdef HAVE_NEW_GUI
+  use_gui = 0; // mp_msg may not use gui stuff in forked code
+#endif
 // cache thread mainloop:
   signal(SIGTERM,exit_sighandler); // kill
   while(1){


More information about the MPlayer-dev-eng mailing list