Hello Markus,

I have just read the below message you sent and you really need to use 
GetMessage and when terminating you need to PostThreadMessage(ThreadID, 
WM_QUIT, 0, 0);

Regards,

SZ

----- Original Message ----- 
From: "Humm, Markus" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, March 27, 2006 1:18 PM
Subject: [twsocket] DLLs and Threads


> Hello,
>
> it seems to work okay right now (not yet creating any sockets) but
> one thing is still sub-optimal, my message pump.
> You advised me to use GetMessage, but that creates the problem
> that the thread won't terminate gracefully if .terminate.
> SendMessage could solve it if it wouldn't require a window as target.
> PeekMessage instead GetMessage works good, except that it consumes 100%
> CPU.
> If I insert sleep(0) which should give up the timeslice (says the help
> at least)
> it also consumes 100% CPU.
> This is my message pump right now (it runs insidy my thread's execute):
>
>                  if (PeekMessage(msg, 0, 0, 0, pm_remove) = true) then
>                  begin
>                    if (msg.message = WM_QUIT) then
>                    begin
>                      {$IFDEF ebmDEBUG}
>                      // Globaler Thread via WM_QUIT beendet. PID = %1
>                      params[1]:=PChar(IntToStr(GetCurrentThreadID));
>
> log.WRITELOG(EVENTLOG_INFORMATION_TYPE,kat_startende,1005,1,params);
>                      {$ENDIF}
>
>                      terminate;
>                    end; // if (msg.message = WM_QUIT) then
>
>                    TranslateMessage(msg);
>                    DispatchMessage(msg);
>                    sleep(0);
>                  end // if (PeekMessage(msg, 0, 0, 0, pm_remove) =
> true) then
>                  else
>                    sleep(0);
>
> What should I do?
>
> Greetings
>
> Markus
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to