diff --git a/rtl/inc/systemh.inc b/rtl/inc/systemh.inc index b741beca93..a83abe47d3 100644 --- a/rtl/inc/systemh.inc +++ b/rtl/inc/systemh.inc @@ -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 diff --git a/rtl/inc/thread.inc b/rtl/inc/thread.inc index 2faead3655..04c6dd0642 100644 --- a/rtl/inc/thread.inc +++ b/rtl/inc/thread.inc @@ -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 diff --git a/rtl/unix/cthreads.pp b/rtl/unix/cthreads.pp index 80d5388152..46ca3284de 100644 --- a/rtl/unix/cthreads.pp +++ b/rtl/unix/cthreads.pp @@ -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