[fpc-devel] TMultiReadExclusiveWriteSynchronizer does not allow "read lock" promoting to a "write lock"

Inoussa OUEDRAOGO inoussa12 at gmail.com
Fri Feb 19 21:02:22 CET 2010


Hi

The TMultiReadExclusiveWriteSynchronizer implementation does not allow
"read lock" promoting
to a "write lock". The program above hang in FPC 2.4 and 2.5.x while
working in Delphi and
FPC 2.2.x. It hangs at the "x.Beginwrite();" instruction. The
implementation clearly does
not support this scenario. It will be helpfull to note this in the
documentation.

<code>
program test;

{$mode objfpc}{$H+}

uses
  SysUtils;

var
  x : TMultiReadExclusiveWriteSynchronizer;
begin
  x := TMultiReadExclusiveWriteSynchronizer.Create();
  x.Beginread();
    WriteLn('Beginread');
    x.Beginwrite();
      WriteLn('Beginwrite');
    x.Endwrite();
      WriteLn('Endwrite');
  x.Endread();
    WriteLn('Endread');

  ReadLn;
end.
</code>

-- 
Inoussa O.



More information about the fpc-devel mailing list