* new oldlinux unit. 1_0 defines killed in some former FCL parts.

This commit is contained in:
marco 2003-11-10 16:54:28 +00:00
parent 99cfbbb225
commit 8f76f86ce5
3 changed files with 3356 additions and 396 deletions

View File

@ -37,7 +37,7 @@ uses
implementation implementation
uses uses
BaseUnix,unix,Linux BaseUnix,unix
; ;
{ OS - independent class implementations are in /inc directory. } { OS - independent class implementations are in /inc directory. }
@ -56,7 +56,10 @@ finalization
end. end.
{ {
$Log$ $Log$
Revision 1.1 2003-10-06 21:01:06 peter Revision 1.2 2003-11-10 16:54:28 marco
* new oldlinux unit. 1_0 defines killed in some former FCL parts.
Revision 1.1 2003/10/06 21:01:06 peter
* moved classes unit to rtl * moved classes unit to rtl
Revision 1.7 2003/09/20 15:10:30 marco Revision 1.7 2003/09/20 15:10:30 marco

View File

@ -53,7 +53,7 @@ end;
//function SIGCHLDHandler(Sig: longint): longint; cdecl;//this is std linux C declaration as function //function SIGCHLDHandler(Sig: longint): longint; cdecl;//this is std linux C declaration as function
procedure SIGCHLDHandler(Sig: longint); cdecl; procedure SIGCHLDHandler(Sig: longint); cdecl;
begin begin
{$ifdef ver1_0}waitpid{$else}fpwaitpid{$endif}(-1, nil, WNOHANG); fpwaitpid(-1, nil, WNOHANG);
end; end;
procedure InitThreads; procedure InitThreads;
@ -74,11 +74,7 @@ begin
Act^.sa_handler := @SIGCHLDHandler; Act^.sa_handler := @SIGCHLDHandler;
Act^.sa_flags := SA_NOCLDSTOP {or SA_NOMASK or SA_RESTART}; Act^.sa_flags := SA_NOCLDSTOP {or SA_NOMASK or SA_RESTART};
Fillchar(Act^.sa_mask,sizeof(Act^.sa_mask),0); //Do not block all signals ??. Don't need if SA_NOMASK in flags Fillchar(Act^.sa_mask,sizeof(Act^.sa_mask),0); //Do not block all signals ??. Don't need if SA_NOMASK in flags
{$ifdef ver1_0}
SigAction(SIGCHLD, Act, OldAct);
{$else}
FpSigAction(SIGCHLD, @Act, @OldAct); FpSigAction(SIGCHLD, @Act, @OldAct);
{$endif}
FreeMem(Act, SizeOf(SigActionRec)); FreeMem(Act, SizeOf(SigActionRec));
FreeMem(OldAct, SizeOf(SigActionRec)); FreeMem(OldAct, SizeOf(SigActionRec));
@ -161,7 +157,7 @@ begin
Thread.DoTerminate; Thread.DoTerminate;
if FreeThread then if FreeThread then
Thread.Free; Thread.Free;
{$ifdef ver1_0}ExitProcess{$else}fpexit{$endif}(Result); fpexit(Result);
end; end;
@ -195,7 +191,7 @@ begin
WaitFor; WaitFor;
end; end;
if FHandle <> -1 then if FHandle <> -1 then
{$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGKILL); fpkill(FHandle, SIGKILL);
dec(FStackPointer,FStackSize); dec(FStackPointer,FStackSize);
Freemem(FStackPointer); Freemem(FStackPointer);
FFatalException.Free; FFatalException.Free;
@ -228,11 +224,8 @@ var
P: Integer; P: Integer;
I: TThreadPriority; I: TThreadPriority;
begin begin
P := {$ifdef ver1_0} P :=
Linux.GetPriority(Prio_Process,FHandle);
{$else}
Unix.fpGetPriority(Prio_Process,FHandle); Unix.fpGetPriority(Prio_Process,FHandle);
{$endif}
Result := tpNormal; Result := tpNormal;
for I := Low(TThreadPriority) to High(TThreadPriority) do for I := Low(TThreadPriority) to High(TThreadPriority) do
if Priorities[I] = P then if Priorities[I] = P then
@ -242,11 +235,7 @@ end;
procedure TThread.SetPriority(Value: TThreadPriority); procedure TThread.SetPriority(Value: TThreadPriority);
begin begin
{$ifdef ver1_0}
Linux.SetPriority(Prio_Process,FHandle,Priorities[Value]);
{$else}
Unix.fpSetPriority(Prio_Process,FHandle,Priorities[Value]); Unix.fpSetPriority(Prio_Process,FHandle,Priorities[Value]);
{$endif}
end; end;
@ -272,14 +261,14 @@ end;
procedure TThread.Suspend; procedure TThread.Suspend;
begin begin
{$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGSTOP); fpkill(FHandle, SIGSTOP);
FSuspended := true; FSuspended := true;
end; end;
procedure TThread.Resume; procedure TThread.Resume;
begin begin
{$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGCONT); fpkill(FHandle, SIGCONT);
FSuspended := False; FSuspended := False;
end; end;
@ -294,15 +283,18 @@ var
status : longint; status : longint;
begin begin
if FThreadID = MainThreadID then if FThreadID = MainThreadID then
{$ifdef ver1_0}waitpid{$else}fpwaitpid{$endif}(0,@status,0) fpwaitpid(0,@status,0)
else else
{$ifdef ver1_0}waitpid{$else}fpwaitpid{$endif}(FHandle,@status,0); fpwaitpid(FHandle,@status,0);
Result:=status; Result:=status;
end; end;
{ {
$Log$ $Log$
Revision 1.2 2003-11-03 09:42:28 marco Revision 1.3 2003-11-10 16:54:28 marco
* new oldlinux unit. 1_0 defines killed in some former FCL parts.
Revision 1.2 2003/11/03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch * Peter's Cardinal<->Longint fixes patch
Revision 1.1 2003/10/06 21:01:06 peter Revision 1.1 2003/10/06 21:01:06 peter

File diff suppressed because it is too large Load Diff