[MPlayer-dev-eng] [PATCH] Better handling of win32 GUI thread

Zuxy Meng zuxy.meng at gmail.com
Thu Nov 1 11:36:10 CET 2007


Hi,

2007/11/1, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
> Hello,
> On Thu, Nov 01, 2007 at 05:37:59PM +0800, Zuxy Meng wrote:
> > @@ -459,7 +459,7 @@
> >      if(sub_window) ShowWindow(mygui->subwindow, SW_SHOW);
> >  }
> >
> > -static DWORD WINAPI GuiThread(void)
> > +static unsigned __stdcall GuiThread(void* param)
> >  {
> >      MSG msg;
> >
> > @@ -486,12 +486,12 @@
> >
> >  void guiInit(void)
> >  {
> > -    DWORD threadId;
> > +    unsigned threadId;
>
> Why? WINAPI is exactly the same as __stdcall (and WINAPI is used more
> often in MPlayer IIRC).

This is to be more consistent becaue _beginthreadex() is a CRT
function that doesn't even know WINAPI and its prototype doesn't use
it either.

> But actually the docs I found say that it must be __cdecl.

I guess you were referring to _beginthread().

> While DWORD is unfortunately unsigned long, it does not matter at least
> as long as we aren't able to build 64 bit windows binaries, so this
> seems like a at most cosmetic change to me as well.

Ditto.

> And isn't there a sane way to avoid the leak and still use the more
> standard CreateThread?

Unfortunately no unless we can make sure the thread won't call any CRT
functions. We have to accept it because this is Windows:-)

-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6



More information about the MPlayer-dev-eng mailing list