diff --git a/rtl/objpas/classes/classes.inc b/rtl/objpas/classes/classes.inc index ac59f61e5b..715de5b8f1 100644 --- a/rtl/objpas/classes/classes.inc +++ b/rtl/objpas/classes/classes.inc @@ -236,7 +236,7 @@ begin // enable for all platforms once http://bugs.freepascal.org/view.php?id=16884 // is fixed for all platforms (in case the fix for non-unix platforms also // requires this field at least) -{$if defined(unix) or defined(windows)} +{$if defined(unix) or defined(windows) or defined(os2)} if not FExternalThread and not FInitialSuspended then Resume; {$endif} diff --git a/rtl/objpas/classes/classesh.inc b/rtl/objpas/classes/classesh.inc index adb906bca7..ca7a463b53 100644 --- a/rtl/objpas/classes/classesh.inc +++ b/rtl/objpas/classes/classesh.inc @@ -1602,7 +1602,7 @@ type procedure Queue(aMethod: TThreadMethod); property ReturnValue: Integer read FReturnValue write FReturnValue; property Terminated: Boolean read FTerminated; -{$ifdef windows} +{$if defined(windows) or defined(OS2)} private FInitialSuspended: boolean; {$endif} diff --git a/rtl/os2/tthread.inc b/rtl/os2/tthread.inc index ece7c3dc49..28a4922942 100644 --- a/rtl/os2/tthread.inc +++ b/rtl/os2/tthread.inc @@ -107,8 +107,11 @@ var Flags: cardinal; begin AddThread; - Flags := dtStack_Commited; + { Always start in suspended state, will be resumed in AfterConstruction if necessary + See Mantis #16884 } + Flags := dtStack_Commited or dtSuspended; FSuspended := CreateSuspended; + FInitialSuspended := CreateSuspended; if FSuspended then Flags := Flags or dtSuspended; FHandle := BeginThread (nil, StackSize, @ThreadProc, pointer (Self), Flags, FThreadID);