Comparing reader-writer implementations

To compare different implementations, I have prepared a test program called ReadersWriterLock stored in the Readers-writer lock folder. This program starts six reader threads that process a shared list and one writer thread that modifies this list ten times per second.

A method, RunTests, which you can look up in the code, accepts a IReadWriteSync interface and runs the tests on it. The form contains three buttons, each one to run tests on a specific implementation, as follows:

procedure TfrmReadersWriter.btnMREWClick(Sender: TObject);begin  RunTests('TMREWSync', TMREWSync.Create);end;procedure TfrmReadersWriter.btnSimpleRWClick(Sender: TObject);begin RunTests('TSimpleRWSync', TSimpleRWSync.Create); ...

Get Mastering Delphi Programming: A Complete Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.