Start a Project

Thread Sanitizer in iOS

Before starting with Thread Sanitizer. We need to know the concept of a data race.

A data race is accessing the same address from two different threads at the same time.

This is also known as Race condition.

If the above condition occurs there will different types of errors occur Like crashes etc.

Simulate

For better understanding, we need to simulate a race condition.

Please check the below image to enable the thread simulator in project

For example in the view controller without a data race condition

After adding race condition and without ThreadSanitizer

Example in which data race condition occurs and thread sanitizer enabled

Conclusion

We can simply prevent our application from crashed-like conditions by using the above concept in the application.

I hope this blog helps you to understand the functionality of Thread Sanitizer concept.

Thanks for Reading !!

Exit mobile version