Condividi tramite


IVsTextStream.LockBuffer Method

Definition

Locks the text buffer for the purpose of access control.

public:
 int LockBuffer();
public:
 int LockBuffer();
int LockBuffer();
public int LockBuffer ();
abstract member LockBuffer : unit -> int
Public Function LockBuffer () As Integer

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Implements

Remarks

Starting in Visual Studio 2010, you should access the text buffer on the UI thread, not on background threads. The text buffer no longer gets locked when you call LockBuffer or LockBufferEx. Similarly, the UnlockBuffer and UnlockBufferEx methods no longer have any effect.

COM Signature

From textmgr.idl:

HRESULT IVsTextStream::LockBuffer();  

When the LockBuffer method is called by one thread, no other thread can perform write operations on the buffer. To unlock the buffer, call UnlockBuffer.

Applies to