- Notifications
You must be signed in to change notification settings - Fork5.2k
Expose aLock type in preview mode#87672
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ghost commentedJun 16, 2023
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
ghost commentedJun 16, 2023
Tagging subscribers to this area:@mangod9 Issue Details
API review:#34812
|
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Lock.NativeAot.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Lock.NativeAot.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Private.CoreLib/src/System/Threading/Lock.NonNativeAot.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
vargaz commentedJun 16, 2023
The mono changes look ok. |
kouvel commentedJun 16, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Here are some perf numbers on NativeAOT. I used a test that has multiple threads enter a lock, perform a short delay, exit the lock, and perform another short delay. Throughput is the number of enter+delay+exit+delay rounds performed per ms. The delay is a recursive calculation of a random Fibonacci number between 4 and 9. The numbers are from my Intel x64 6-core 12-thread machine on Windows. Using
Using
|
| returntrue; | ||
| } | ||
| thrownewLockRecursionException(SR.Lock_Enter_LockRecursionException); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think I'm following how this gets thrown. It would mean _recursionCount was -1. I don't see a test in LockTests for LockRecursionException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Oh - you're using 32 bit overflowlike Native AOT .. since this is a new type, how about picking something smaller that is still always going to mean a bug in the app, but small enough that it won't cause a hang in the app (and also becomes feasibly unit testable). Eg., 65K
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
in fact that's what the comment suggests "is expected to be high enough that it would typically not be reached when the lock is used properly."
Uh oh!
There was an error while loading.Please reload this page.
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Lock.NativeAot.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
kouvel commentedJun 17, 2023
Rebased to fix conflicts |
VSadov commentedJun 19, 2023
/azp run runtime-extra-platforms |
| Azure Pipelines successfully started running 1 pipeline(s). |
kouvel commentedOct 28, 2023
Trying a rebase due to some unrelated build failures. |
kouvel commentedOct 30, 2023
The remaining issues in the CI appear to be unrelated. |
radical commentedOct 31, 2023
This was merged on Red and broke Wasm.Build.Tests on |
radical commentedOct 31, 2023
Also one of thefailures is: Could this be related to the change here? I have never seen this happen on the tests before. cc@lewing |
jkotas commentedOct 31, 2023
Also introduced#94227 |
kouvel commentedOct 31, 2023
I have no idea how this PR could cause those failures, apologies if there was a mishap. There are only a few lines of code in this PR that would affect wasm, do you see anything that could be relevant? I'll see if I can get a repro, but otherwise I don't see any link between the failure and this PR.
#94241 should fix the issue. |
kouvel commentedOct 31, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Only thing I can think of at the moment is that there is a pragma warning disable for using preview features when we should probably be enabling preview features for the corelib project. I don't know what kind of effect that would have, but I think that's something that was missed after local testing and unaddressed, so I'll fix that anyway. |
* Small cleanup for Lock in Mono- Enable preview features in shared CoreLib project instead of disabling the compiler warning. Probably a bit cleaner, and would enable using Lock in other libraries to try it out.- Undid an unnecessary change from#87672
Uh oh!
There was an error while loading.Please reload this page.
Locktype requires preview features to be enabledLockimplementation, and fixed a couple of issues.Lockimplementation. The performance of acquiring a lock under contention is improved in NativeAOT.API review:#34812
Tracking issue:#87673