RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomWinSocket.Lock Method

Starts a critical section, blocking all other execution threads until the Unlock method is called.

Pascal
procedure Lock;
C++
__fastcall Lock();

Call Lock before beginning a section of code that is not thread-safe. Call Unlock when the critical section of code is completed. Unless absolutely necessary, do not use Lock to lock lengthy operations such as reading and writing over a blocking connection. Locking lengthy operations can severely impact performance, because all execution threads in the application that use the Windows socket object must wait until Unlock is called. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!