AvalonStudio.TextEditor.Document.TextDocument.SetOwnerThread C# (CSharp) Method

SetOwnerThread() public method

Transfers ownership of the document to another thread. This method can be used to load a file into a TextDocument on a background thread and then transfer ownership to the UI thread for displaying the document.

The owner can be set to null, which means that no thread can access the document. But, if the document has no owner thread, any thread may take ownership by calling SetOwnerThread.

public SetOwnerThread ( Thread newOwner ) : void
newOwner Thread
return void
		public void SetOwnerThread(Thread newOwner)
		{
			// We need to lock here to ensure that in the null owner case,
			// only one thread succeeds in taking ownership.
			lock (lockObject)
			{
				if (owner != null)
				{
					VerifyAccess();
				}
				owner = newOwner;
			}
		}