function BeginWrite: Boolean;
bool __fastcall BeginWrite();
Allows a thread to write to the protected memory when it is safe to do so.
BeginWrite obtains an exclusive write lock on the memory protected by the synchronizer object. Call BeginWrite before writing to this memory. BeginWrite does not return until no other threads are reading from or writing to the memory. After a thread calls BeginWrite, any other thread asking to access that memory by calling BeginRead or BeginWrite must wait until the writing thread calls EndWrite.
Note that a write lock operation is not atomic. Data in protected memory will always be in a consistent state when BeginWrite returns, but is not necessarily in the same state as when BeginWrite was called. As a rule, a thread should always discard previous samples from protected memory after promoting a read lock to a write lock. However, the calling thread can determine whether a state change has occurred by examining return value of BeginWrite: True if the protected memory has not been written to by another thread or False if another thread may have modified the protected memory.