* fix for bug #16884 for OS/2

git-svn-id: trunk@29712 -
This commit is contained in:
Tomas Hajny 2015-02-15 19:39:53 +00:00
parent 42cc1d504f
commit 590e2f7977
3 changed files with 6 additions and 3 deletions

View File

@ -236,7 +236,7 @@ begin
// enable for all platforms once http://bugs.freepascal.org/view.php?id=16884 // 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 // is fixed for all platforms (in case the fix for non-unix platforms also
// requires this field at least) // 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 if not FExternalThread and not FInitialSuspended then
Resume; Resume;
{$endif} {$endif}

View File

@ -1602,7 +1602,7 @@ type
procedure Queue(aMethod: TThreadMethod); procedure Queue(aMethod: TThreadMethod);
property ReturnValue: Integer read FReturnValue write FReturnValue; property ReturnValue: Integer read FReturnValue write FReturnValue;
property Terminated: Boolean read FTerminated; property Terminated: Boolean read FTerminated;
{$ifdef windows} {$if defined(windows) or defined(OS2)}
private private
FInitialSuspended: boolean; FInitialSuspended: boolean;
{$endif} {$endif}

View File

@ -107,8 +107,11 @@ var
Flags: cardinal; Flags: cardinal;
begin begin
AddThread; 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; FSuspended := CreateSuspended;
FInitialSuspended := CreateSuspended;
if FSuspended then Flags := Flags or dtSuspended; if FSuspended then Flags := Flags or dtSuspended;
FHandle := BeginThread (nil, StackSize, @ThreadProc, pointer (Self), FHandle := BeginThread (nil, StackSize, @ThreadProc, pointer (Self),
Flags, FThreadID); Flags, FThreadID);