-
Notifications
You must be signed in to change notification settings - Fork 734
Add locks on concurrent alias following checker accesses under incremental mode #2051
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
base: main
Are you sure you want to change the base?
Changes from all commits
443de4e
2b0ad78
8034f94
8bbe411
b42a8b5
821a91c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,7 @@ import ( | |||||||||||
| type CheckerPool interface { | ||||||||||||
| GetChecker(ctx context.Context) (*checker.Checker, func()) | ||||||||||||
| GetCheckerForFile(ctx context.Context, file *ast.SourceFile) (*checker.Checker, func()) | ||||||||||||
| GetCheckerForFileExclusive(ctx context.Context, file *ast.SourceFile) (*checker.Checker, func()) | ||||||||||||
| GetAllCheckers(ctx context.Context) ([]*checker.Checker, func()) | ||||||||||||
| Files(checker *checker.Checker) iter.Seq[*ast.SourceFile] | ||||||||||||
| } | ||||||||||||
|
|
@@ -24,6 +25,7 @@ type checkerPool struct { | |||||||||||
|
|
||||||||||||
| createCheckersOnce sync.Once | ||||||||||||
| checkers []*checker.Checker | ||||||||||||
| locks []sync.Mutex | ||||||||||||
| fileAssociations map[*ast.SourceFile]*checker.Checker | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
@@ -34,6 +36,7 @@ func newCheckerPool(checkerCount int, program *Program) *checkerPool { | |||||||||||
| program: program, | ||||||||||||
| checkerCount: checkerCount, | ||||||||||||
| checkers: make([]*checker.Checker, checkerCount), | ||||||||||||
| locks: make([]sync.Mutex, checkerCount), | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| return pool | ||||||||||||
|
|
@@ -45,6 +48,16 @@ func (p *checkerPool) GetCheckerForFile(ctx context.Context, file *ast.SourceFil | |||||||||||
| return checker, noop | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| func (p *checkerPool) GetCheckerForFileExclusive(ctx context.Context, file *ast.SourceFile) (*checker.Checker, func()) { | ||||||||||||
| c, done := p.GetCheckerForFile(ctx, file) | ||||||||||||
| idx := slices.Index(p.checkers, c) | ||||||||||||
|
||||||||||||
| idx := slices.Index(p.checkers, c) | |
| idx := slices.Index(p.checkers, c) | |
| if idx == -1 { | |
| panic("checker not found in checker pool") | |
| } |
Uh oh!
There was an error while loading. Please reload this page.