[MPlayer-cygwin] What about CreateThread patch?
Gianluigi Tiesi
mplayer at netfarm.it
Tue Apr 3 02:53:51 CEST 2007
On Tue, Apr 03, 2007 at 02:16:36AM +0300, Sergey wrote:
> Hello, mplayer-cygwin.
>
> What about this patch for win32 GUI? Without this patch mplayer GUI
> does not start at least under Win98 SE (tested on two win98 machines,
> can also check on several WinME).
> With this patch applied GUI works.
>
> From MSDN: http://msdn2.microsoft.com/en-us/library/ms682453.aspx
> lpThreadId
> [out] A pointer to a variable that receives the thread identifier.
> If this parameter is NULL, the thread identifier is not returned.
> Windows Me/98/95: This parameter may not be NULL.
>
> --- mplayer/Gui/win32/interface.c Sat Oct 14 03:31:58 2006
> +++ mplayer.my/Gui/win32/interface.c Mon Nov 6 02:34:08 2006
> @@ -453,11 +453,12 @@
>
> void guiInit(void)
> {
> + DWORD threadId; // required for CreateThread under win9x/ME
> memset(&guiIntfStruct, 0, sizeof(guiIntfStruct));
> /* Create The gui thread */
> if (!mygui)
> mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Creating GUI Thread 0x%04x\n",
> - (int) CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) GuiThread, NULL, 0, NULL));
> + (int) CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) GuiThread, NULL, 0, &threadId));
>
> /* Wait until the gui is created */
> while(!mygui) Sleep(100);
> ****** end of patch
>
it's very bad idea to add a functional statement (creathread) inside a
mp_msg, the thread it stuff is ok, but it would be better to do:
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) GuiThread, NULL, 0, &threadId);
mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Creating GUI Thread 0x%04x\n", threadId);
More information about the MPlayer-cygwin
mailing list