Delphi MREW implementation that favors readers?

你说的曾经没有我的故事 提交于 2019-12-07 13:44:58

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/1742915/delphi-mrew-implementation-that-favors-readers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!