[fpc-devel] daemonapp 100% cpu easting fix
Mattias Gaertner
nc-gaertnma at netcologne.de
Sat Nov 17 13:39:37 CET 2007
On Sat, 17 Nov 2007 10:12:30 -0200
Steve Howe <howesteve at gmail.com> wrote:
> Hello all,
>
> While using the daemonapp.pp unit to code a daemon, I've found that
> applications that it eat 100% of the CPU. After tracking and
> debugging, I've found out that the problem is in the daemonapp's
> TDaemonThread.Execute() method:
>
> procedure TDaemonThread.Execute;
>
> begin
> If FDaemon.Start then
> begin
> FDaemon.Status:=csRunning;
> StartServiceExecute;
> if not FDaemon.Execute then
> begin
> While Not Terminated do
> CheckControlMessage(True);
> CheckControlMessage(False);
> end;
> end;
> end;
>
> The loop has no interval so it just consumes all free CPU.
Then CheckControlMessage has a bug. The 'True' means it should wait for
the next message.
But I see no 'virtual' and no code in this function - strange (fpc
2.3.1).
> Does anyone have a better solution or comments ? Should I submit a
> patch ? If the changed is accepted and someone could do it for me, it
> would be even better.
Mattias
More information about the fpc-devel
mailing list