Free Support Forum - aspose.com

Thread Safe Question

Hi,

Is Aspose.Network.dll guaranteed to be thread safe?

Can Aspose.Network.License.SetLicense() be called many times in different thread safely?

Thanks.

Hi,

Most of the classes do not guarantee thread safety for the instance members. Each class has “Thread Safety” related documentation in the API section e.g. http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/aspose.network.mail.smtpclient.html.

The license should be set only once per process/application. In a multithreaded application, you may set the license in the main() or init() method of the program where you are creating the threads.

Attached is an example that creates some email messages in thread and also sets the license in main() method. Aspose classes are used in another class and the license is applicable to these classes.