+ More system-independent thread routines

This commit is contained in:
michael 2002-10-16 19:04:27 +00:00
parent 83dae76625
commit cb5a3c7050
3 changed files with 42 additions and 3 deletions

View File

@ -18,6 +18,20 @@
Threadvar initialization
*****************************************************************************}
procedure InitThread(stklen:cardinal);
begin
SysResetFPU;
{ ExceptAddrStack and ExceptObjectStack are threadvars }
{ so every thread has its on exception handling capabilities }
SysInitExceptions;
{ Open all stdio fds again }
SysInitStdio;
InOutRes:=0;
// ErrNo:=0;
{ Stack checking }
StackLength:=stklen;
StackBottom:=Sptr - StackLength;
end;
{*****************************************************************************
Overloaded functions
@ -67,7 +81,10 @@
{
$Log$
Revision 1.1 2002-10-14 19:39:17 peter
Revision 1.2 2002-10-16 19:04:27 michael
+ More system-independent thread routines
Revision 1.1 2002/10/14 19:39:17 peter
* threads unit added for thread support
}

View File

@ -14,6 +14,10 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
const
DefaultStackSize = 32768; { including 16384 margin for stackchecking }
type
TThreadFunc = function(parameter : pointer) : longint;
@ -50,7 +54,10 @@ procedure LeaveCriticalsection(var cs : TRTLCriticalSection);
{
$Log$
Revision 1.8 2002-10-14 19:39:17 peter
Revision 1.9 2002-10-16 19:04:27 michael
+ More system-independent thread routines
Revision 1.8 2002/10/14 19:39:17 peter
* threads unit added for thread support
Revision 1.7 2002/09/07 15:07:46 peter

View File

@ -85,11 +85,26 @@ begin
copy_unit_threadvars (ThreadvarTablesTable.tables[i]);
end;
procedure InitThreadVars(RelocProc : Pointer);
begin
{ initialize threadvars }
init_all_unit_threadvars;
{ allocate mem for main thread threadvars }
SysAllocateThreadVars;
{ copy main thread threadvars }
copy_all_unit_threadvars;
{ install threadvar handler }
fpc_threadvar_relocate_proc:=RelocProc;
end;
{$endif HASTHREADVAR}
{
$Log$
Revision 1.1 2002-10-14 19:39:17 peter
Revision 1.2 2002-10-16 19:04:27 michael
+ More system-independent thread routines
Revision 1.1 2002/10/14 19:39:17 peter
* threads unit added for thread support
}