RS
Size: a a a
RS
RS
SignalSet;
{$IFDEF DAEMONIZE}
Pid := FpFork;
{$ELSE}
Pid := -1;
{$ENDIF}
case Pid of
0:
begin { we are in the child }
WriteLog('Fork process');
Close(Input); { close standard in }
Close(Output); { close standard out }
AssignFile(Output, '/dev/null');
Rewrite(Output);
Close(StdErr); { close standard error }
AssignFile(StdErr, '/dev/null');
ReWrite(StdErr);
end;
-1: {FSecs := 0}; { forking error, so run as non-daemon }
else
Halt; { successful fork, so parent dies }
end;
DB
RS
RS
DB
RS
DB
DB
DB
RS
DB
RS
DB
TCustomDaemon
Данный класс реализует основную работу службы (демона) и является потомком TDataModule. Программа может использовать несколько классов TCustomDaemons и/или их экземпляров одновременно в одном процессе. Иными словами использовать много поточность в своей работе.
DB
RS
DB
RS
DB
RS