This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Conversation
Closed
Member
Author
|
Closing again until fixed, seems to deadlock a dmd test. |
Member
Author
|
Ready now, after fixing a dead-lock caused by onOutOfMemoryError. |
95c6505 to
5738103
Compare
Member
Author
|
updated to resolve merge conflict |
src/core/internal/spinlock.d
Outdated
| { | ||
| for (size_t n; atomicLoad!(MemoryOrder.raw)(val); ++n) | ||
| yield(n); | ||
| if (cas(&val, false, true)) |
Member
There was a problem hiding this comment.
Don't you want to optimistically start with the cas?
Member
Author
There was a problem hiding this comment.
Done, hardly measurable.
Member
|
I was to pull this, but raises enough flags to warrant another pass. |
- the compiler doesn't recognize this as super call and will use dynamic dispatch leading to an infinite loop
- less overhead than pthread_mutex - uses test and test-and-set algorithm with configurable backoff
- always use runLocked which now unlocks on error - check for recursive GC entrance during finalization inFinalizer can be thread local b/c we're finalizing in the same thread that currently holds the lock
- all trace handlers should be @nogc but that's currently out of scope b/c it requires to rewrite all backtrace and demangle code
Member
Author
|
|
||
| void lock() | ||
| { | ||
| if (cas(&val, size_t(0), size_t(1))) |
Member
There was a problem hiding this comment.
I think restructuring this function as a do/while so there's only one cas() might generate tighter code. But not urgent.
Member
Author
There was a problem hiding this comment.
I wanted to avoid accessing the contention field.
Member
|
Auto-merge toggled on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Had to reopen spinlock for GC by MartinNowak · Pull Request #1153 after force pushing, please look the existing review before repeating any questions.