Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi MREW implementation that favors readers?

Is there a Delphi implementation of an MREW (multiple read, exclusive write) lock, that favors reading over writing?

like image 983
jpfollenius Avatar asked Oct 23 '25 16:10

jpfollenius


2 Answers

I think the TMultiReadExclusiveWriteSynchronizer already favors readers.

As the name of the component implies, a TMREWS should be used when there is much reading and little writing to be done. In addition, the READ operations should be kept to a MINIMUM otherwise your write threads could be left waiting indefinitely.

It is in the SysUtils unit.

like image 93
Jorge Córdoba Avatar answered Oct 26 '25 07:10

Jorge Córdoba


Check out TJclMultiReadExclusiveWrite from the Project JEDI JCL (http://www.delphi-jedi.org/). The constructor of that class supports a parameter that tell the code which to favor - readers, writers, or consider them to be equal.

like image 29
Jason Swager Avatar answered Oct 26 '25 08:10

Jason Swager



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!