Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/RTL/Delphi/Thread support    [ Add a report in this area ]  
Report #:  90487   Status: Closed
TMonitor.Enter, closing app, hangs in SysUtils.DoneMonitorSupport
Project:  Delphi Build #:  14.0.3593.25826
Version:    14.0 Submitted By:   andre mussche
Report Type:  Basic functionality failure Date Reported:  12/22/2010 11:57:17 PM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   281510
Resolution: Test Case Error (Resolution Comments) Resolved in Build: : 16.0.4223.41907
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
When using TMonitor.Enter in 2 threads (so one gets locked) and never releasing the lock, the application will hang (100%) in DoneMonitorSupport  when closing.
Steps to Reproduce:
1: Use code below
2: start app
3: close app
4: 100 cpu%!

==============================

unit Unit5;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm5 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TTestThread = class(TThread)
  protected
    procedure Execute;override;
  end;

var
  Form5: TForm5;

implementation

{$R *.dfm}

var
  o: TObject;

procedure TForm5.FormCreate(Sender: TObject);
begin
  o := TObject.Create;
  System.TMonitor.Enter(o);

  TTestThread.Create(False {direct run});
end;

{ TTestThread }

procedure TTestThread.Execute;
begin
  System.TMonitor.Enter(o);
end;

end.
Workarounds
None, only be very sure to release all locks and free all objects...
Attachment
None
Comments

None

Server Response from: ETNACODE01