JCL Help:TJclMultiReadExclusiveWrite.BeginRead

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Allows a thread read-access to the protected resource, blocking until the access can be granted.


Pascal

 public procedure BeginRead;


Description

BeginRead allows a thread to gain read-access to the protected resource. This method will block the calling thread until read-access can be granted. After the thread has been granted access other threads may request, and be granted, read-access to the protected resource but write access requests will be denied until all threads that hold read-access have finished using the resource. A thread which has been granted read-access must eventually call EndRead to signal that it has finished using the resource. Note that read-access can be promoted to write-access by calling BeginWrite, however, both the calls to BeginRead and BeginWrite must have a matching call to EndRead and EndWrite respectively. It is safe to call BeginRead while already holding read-access, it merely increments a recursion count. If you call BeginRead multiple times you must also call EndRead multiple times. That is, the calls to BeginRead and EndRead must be balanced. Note that even if the class has only granted access to readers while BeginRead is called, the calling thread may still be blocked depending on the Preferred value passed to the constructor.


See Also

EndRead BeginWrite EndWrite


About

Donator

Marcel van Brakel


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page