mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 02:59:33 +02:00
* small fixes. fcl now compiles
This commit is contained in:
parent
5241d352b1
commit
d7235fa3ed
@ -40,7 +40,7 @@ uses
|
||||
{$ifdef ver1_0}
|
||||
linux
|
||||
{$else}
|
||||
unix
|
||||
BaseUnix,unix
|
||||
{$endif}
|
||||
;
|
||||
|
||||
@ -60,7 +60,10 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2002-10-14 19:45:54 peter
|
||||
Revision 1.7 2003-09-20 15:10:30 marco
|
||||
* small fixes. fcl now compiles
|
||||
|
||||
Revision 1.6 2002/10/14 19:45:54 peter
|
||||
* threading switch
|
||||
|
||||
Revision 1.5 2002/09/07 15:15:27 peter
|
||||
|
@ -53,7 +53,7 @@ end;
|
||||
//function SIGCHLDHandler(Sig: longint): longint; cdecl;//this is std linux C declaration as function
|
||||
procedure SIGCHLDHandler(Sig: longint); cdecl;
|
||||
begin
|
||||
waitpid(-1, nil, WNOHANG);
|
||||
{$ifdef ver1_0}waitpid{$else}fpwaitpid{$endif}(-1, nil, WNOHANG);
|
||||
end;
|
||||
|
||||
procedure InitThreads;
|
||||
@ -74,8 +74,11 @@ begin
|
||||
Act^.handler.sh := @SIGCHLDHandler;
|
||||
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
|
||||
|
||||
{$ifdef ver1_0}
|
||||
SigAction(SIGCHLD, Act, OldAct);
|
||||
{$else}
|
||||
FpSigAction(SIGCHLD, @Act, @OldAct);
|
||||
{$endif}
|
||||
|
||||
FreeMem(Act, SizeOf(SigActionRec));
|
||||
FreeMem(OldAct, SizeOf(SigActionRec));
|
||||
@ -154,7 +157,7 @@ begin
|
||||
Thread.DoTerminate;
|
||||
if FreeThread then
|
||||
Thread.Free;
|
||||
ExitProcess(Result);
|
||||
{$ifdef ver1_0}ExitProcess{$else}fpexit{$endif}(Result);
|
||||
end;
|
||||
|
||||
|
||||
@ -187,7 +190,7 @@ begin
|
||||
WaitFor;
|
||||
end;
|
||||
if FHandle <> -1 then
|
||||
Kill(FHandle, SIGKILL);
|
||||
{$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGKILL);
|
||||
dec(FStackPointer,FStackSize);
|
||||
Freemem(pointer(FStackPointer),FStackSize);
|
||||
inherited Destroy;
|
||||
@ -218,7 +221,11 @@ var
|
||||
P: Integer;
|
||||
I: TThreadPriority;
|
||||
begin
|
||||
P := {$ifdef ver1_0}Linux{$else}Unix{$endif}.GetPriority(Prio_Process,FHandle);
|
||||
P := {$ifdef ver1_0}
|
||||
Linux.GetPriority(Prio_Process,FHandle);
|
||||
{$else}
|
||||
Unix.fpGetPriority(Prio_Process,FHandle);
|
||||
{$endif}
|
||||
Result := tpNormal;
|
||||
for I := Low(TThreadPriority) to High(TThreadPriority) do
|
||||
if Priorities[I] = P then
|
||||
@ -228,7 +235,11 @@ end;
|
||||
|
||||
procedure TThread.SetPriority(Value: TThreadPriority);
|
||||
begin
|
||||
{$ifdef ver1_0}Linux{$else}Unix{$endif}.SetPriority(Prio_Process,FHandle, Priorities[Value]);
|
||||
{$ifdef ver1_0}
|
||||
Linux.SetPriority(Prio_Process,FHandle,Priorities[Value]);
|
||||
{$else}
|
||||
Unix.fpSetPriority(Prio_Process,FHandle,Priorities[Value]);
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
@ -254,14 +265,14 @@ end;
|
||||
|
||||
procedure TThread.Suspend;
|
||||
begin
|
||||
Kill(FHandle, SIGSTOP);
|
||||
{$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGSTOP);
|
||||
FSuspended := true;
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Resume;
|
||||
begin
|
||||
Kill(FHandle, SIGCONT);
|
||||
{$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGCONT);
|
||||
FSuspended := False;
|
||||
end;
|
||||
|
||||
@ -276,15 +287,18 @@ var
|
||||
status : longint;
|
||||
begin
|
||||
if FThreadID = MainThreadID then
|
||||
WaitPid(0,@status,0)
|
||||
{$ifdef ver1_0}waitpid{$else}fpwaitpid{$endif}(0,@status,0)
|
||||
else
|
||||
WaitPid(FHandle,@status,0);
|
||||
{$ifdef ver1_0}waitpid{$else}fpwaitpid{$endif}(FHandle,@status,0);
|
||||
Result:=status;
|
||||
end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 2002-12-18 20:44:36 peter
|
||||
Revision 1.8 2003-09-20 15:10:30 marco
|
||||
* small fixes. fcl now compiles
|
||||
|
||||
Revision 1.7 2002/12/18 20:44:36 peter
|
||||
* use fillchar to clear sigset
|
||||
|
||||
Revision 1.6 2002/09/07 15:15:27 peter
|
||||
|
@ -21,11 +21,14 @@ Function FpIOCtl(handle:cint;ndx:culong;Data: Pointer):cint; external name 'FPC
|
||||
Function FpGetPid:pid_t; external name 'FPC_SYSC_GETPID';
|
||||
Function FpReadLink(name,linkname:pchar;maxlen:size_t):cint; external name 'FPC_SYSC_READLINK';
|
||||
Function FpNanoSleep(const req : timespec;rem : ptimespec) : longint; external name 'FPC_SYSC_NANOSLEEP';
|
||||
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
|
||||
//function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2003-09-15 20:29:50 marco
|
||||
Revision 1.4 2003-09-20 15:10:30 marco
|
||||
* small fixes. fcl now compiles
|
||||
|
||||
Revision 1.3 2003/09/15 20:29:50 marco
|
||||
* small fix
|
||||
|
||||
Revision 1.2 2003/09/14 20:15:01 marco
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
function fpgettimeofday(tp: ptimeval;tzp:ptimezone):cint; external name 'FPC_SYSC_GETTIMEOFDAY';
|
||||
function fpNice(N:cint):cint;
|
||||
Function fpGetPriority(Which,Who:cint):cint;
|
||||
Function fpSetPriority(Which,Who,What:cint):cint;
|
||||
|
Loading…
Reference in New Issue
Block a user