SocketTools .NET Edition

DnsClient.ThreadModel Property

Gets and sets a value which specifies the threading model for the class instance.

[Visual Basic]
Public Property ThreadModel As ThreadingModel
[C#]
public DnsClient.ThreadingModel ThreadModel {get; set;}

Property Value

Returns one or more ThreadingModel enumeration value which specifies the threading model for the client. The default value for this property is modelSingleThread.

Remarks

The ThreadModel property specifies the threading model that is used by the class instance when a connection is established. The default value for this property is modelSingleThread, which specifies that only the thread that established the connection should be permitted to invoke methods. It is important to note that this threading model does not limit the application to a single thread of execution. When a session is established using the Connect method, that session is attached to the thread that created it. From that point on, until the session is terminated, only the owner may invoke methods in that instance of the class. The ownership of the class instance may be transferred from one thread to another using the AttachThread method.

Setting this property to modelFreeThread disables certain internal safety checks that are performed by the class and may result in unexpected behavior unless you ensure that access to the class instance is synchronized across multiple threads. The application must ensure that no two threads will attempt to invoke a blocking method at the same time. In other words, if one thread invokes a method, the application must ensure that another thread will not attempt to invoke any other method at the same time using the same instance of the class.

See Also

DnsClient Class | SocketTools Namespace | AttachThread Method | ThreadingModel Enumeration | ThreadModel Attribute