-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make use of System.Threading.Lock #20530
base: dev
Are you sure you want to change the base?
Make use of System.Threading.Lock #20530
Conversation
I asked a question on whether ABP wants to continue supporting .NET Standard 2.0 and 2.1 at #20803 (comment). The reason is that if this PR is going to get approved it would need to undergo changes. We would need to use the factory method in https://github.com/MarkCiliaVincenti/Backport.System.Threading.Lock rather than the clean method that we could use if ABP supports only .NET 5.0 or greater (basically anything that doesn't support the notorious thread aborts). |
@maliming do you still want to support .NET Standard 2.0 and 2.1? I want to be able to change this PR accordingly. It would be cleaner as an implementation of only .NET 5.0+ is supported. Due to thread aborts, there are issues with how synchronization can sometimes be broken in < 5.0, for example there is no 100% guarantee that anything that makes use of the using pattern is correctly disposed every time. |
@maliming due to assembly-level attributes, the only way this can avoid a dependency is that a new project file is created and everything in the library is copy and pasted into it, but it would be much cleaner with a dependency that's also tried and tested on production projects. |
Still need an answer for this @maliming. |
hi We will continue to support |
…into net9locking
.NET 9.0 comes with support for a new class
System.Threading.Lock
which offers better performance when locking as opposed to a lock on an object.Through the use of a new dependency,
System.Threading.Lock
is backported to .NET 8.0 and earlier. On .NET 8.0 or earlier, there is neither a performance benefit nor a performance loss when usingSystem.Threading.Lock
. However, once ABP starts supporting .NET 9.0 or later, the code that's written will automatically benefit from improved performance.