ThingWorx Edge .NET SDK Reference > Best Practices for Developing Multi-threaded Client Applications
Best Practices for Developing Multi-threaded Client Applications
When creating a multi-threaded client application using the ThingWorx Edge .NET SDK, keep the following best practices in mind:
1. Use independent threads for:
a. Connection handling
b. Data sending/receiving.
c. Tunnel management
d. File transfer management
e. Logging
2. Provide error handling for background threads:
a. Thread exit or termination should not adversely impact other threads.
b. Errors occurring in background threads should be bubbled up to the main thread.
3. Thread management:
a. The unexpected termination of critical threads should allow the application to exit gracefully.
4. Keep threads as simple as possible
a. Android/iOS environments aggressively terminate threads if they run for too long.
5. Expectation is 24/7 application run time. Thread resources need to be managed correctly. Do not rely on the application terminating to clean up resources.
6. Client applications should only lock local resources, not SDK resources.
Was this helpful?