getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
604 stars 206 forks source link

Use bools and enums with Interlocked.CompareExchange #3686

Open jamescrosswell opened 1 month ago

jamescrosswell commented 1 month ago

In various places in the solution we're using int instead of bool so that we can make use of the Interlocked class, which historically did not support bool and enum. For example: https://github.com/getsentry/sentry-dotnet/blob/96a116c6076d358d6e0c06a1f012c1ed2c7a65d1/src/Sentry.Profiling/SampleProfilerSession.cs#L58-L68

With .net9 Interlocked.CompareExchange supports more types.

We should leverage the new type support to tidy up our code.