Skip to content

Be consistent about syntax to lock, wait, and notify #8818

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

swankjesse
Copy link
Collaborator

The Dispatcher class is an outlier here as it cannot implement the Lockable interface without that leaking into its public API. We do without in that case.

The Dispatcher class is an outlier here as it cannot implement
the Lockable interface without that leaking into its public API.
We do without in that case.
@swankjesse swankjesse requested a review from yschimke May 28, 2025 19:29
@@ -13,6 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think the compiler needed these ’cause of the friends feature, but the IDE really wanted ’em

@@ -212,7 +209,7 @@ class TaskQueue internal constructor(
}

fun shutdown() {
lock.assertNotHeld()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and cancelAll() were both bugs. We were asserting that a lock wasn’t held, but we never held that lock

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about this miss. If I read correctly, they would stop invalid cases that could cause corruption, rather than expose the normal path to risk of race conditions?

Thanks for catching.

@swankjesse swankjesse merged commit 90d3a6b into master May 28, 2025
41 of 42 checks passed
@swankjesse swankjesse deleted the jwilson.0528.locks_syntax branch May 28, 2025 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants