* proper error message if the cthreads unit is included too late

uses clause
This commit is contained in:
florian 2005-04-03 19:29:28 +00:00
parent 9fba928b62
commit d18746bd15
3 changed files with 33 additions and 6 deletions

View File

@ -361,6 +361,9 @@ const
{ assume that this program will not spawn other threads, when the
first thread is started the following constants need to be filled }
IsMultiThread : boolean = FALSE;
{ set to true, if a threading helper is used before a thread
manager has been installed }
ThreadingAlreadyUsed : boolean = FALSE;
{ Indicates if there was an error }
StackError : boolean = FALSE;
InitProc : Pointer = nil;
@ -769,7 +772,11 @@ const
{
$Log$
Revision 1.121 2005-02-25 12:34:46 peter
Revision 1.122 2005-04-03 19:29:28 florian
* proper error message if the cthreads unit is included too late
uses clause
Revision 1.121 2005/02/25 12:34:46 peter
* added HexStr(Pointer)
Revision 1.120 2005/02/14 17:13:29 peter

View File

@ -326,7 +326,9 @@ procedure NoCriticalSection(var CS);
begin
if IsMultiThread then
NoThreadError;
NoThreadError
else
ThreadingAlreadyUsed:=true;
end;
procedure NoInitThreadvar(var offset : dword;size : dword);
@ -388,14 +390,18 @@ function NORTLEventCreate :PRTLEvent;
begin
if IsMultiThread then
NoThreadError;
NoThreadError
else
ThreadingAlreadyUsed:=true
end;
procedure NORTLeventdestroy(state:pRTLEvent);
begin
if IsMultiThread then
NoThreadError;
NoThreadError
else
ThreadingAlreadyUsed:=true
end;
procedure NORTLeventSetEvent(state:pRTLEvent);
@ -469,7 +475,11 @@ end;
{
$Log$
Revision 1.24 2005-02-26 11:40:38 florian
Revision 1.25 2005-04-03 19:29:28 florian
* proper error message if the cthreads unit is included too late
uses clause
Revision 1.24 2005/02/26 11:40:38 florian
* rtl event init/destroy throws only an error if it's used in a mult threaded program
Revision 1.23 2005/02/25 22:02:46 florian

View File

@ -623,12 +623,22 @@ end;
initialization
if ThreadingAlreadyUsed then
begin
writeln('Threading has been used before cthreads was initialized.');
writeln('Make cthreads one of the first units in your uses clause.');
runerror(211);
end;
SetCThreadManager;
finalization
end.
{
$Log$
Revision 1.24 2005-02-25 22:10:27 florian
Revision 1.25 2005-04-03 19:29:28 florian
* proper error message if the cthreads unit is included too late
uses clause
Revision 1.24 2005/02/25 22:10:27 florian
* final fix for linux (hopefully)
Revision 1.23 2005/02/25 22:02:48 florian