You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ParallelSearcher dispatches multiple threads to search a large vector. The main synchronization variable here is keyPosition, which can be read and written to by multiple threads. All threads should have a consistent view of the state of this variable, hence it should be marked volatile.
Component(s)
Java
The text was updated successfully, but these errors were encountered:
kou
changed the title
keyPosition variable in ParallelSearcher should be marked volatile
[Java] keyPosition variable in ParallelSearcher should be marked volatileJun 19, 2023
…llelSearcher` (#36152)
### Rationale for this change
Multiple threads can read/write to the `keyPosition` variable. Thus, it should be declared `volatile` so that all threads have a consistent view of the value of this variable.
### What changes are included in this PR?
This PR just marks an instance member `volatile`.
### Are these changes tested?
Existing tests should suffice as no functionality is being changed.
### Are there any user-facing changes?
No, there are no user facing changes. There are no changes to the public API either.
* Closes: #36151
Authored-by: Ramasai <ramasai.tadepalli+3108@gmail.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Describe the enhancement requested
ParallelSearcher
dispatches multiple threads to search a large vector. The main synchronization variable here iskeyPosition
, which can be read and written to by multiple threads. All threads should have a consistent view of the state of this variable, hence it should be markedvolatile
.Component(s)
Java
The text was updated successfully, but these errors were encountered: