views:

116

answers:

2

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

+5  A: 

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.

Jorge Córdoba
A: 

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.

Jason Swager