Skip to content
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

proposal: add thread check for most of the not thread-safe methods #590

Open
smartcmd opened this issue Feb 26, 2025 · 0 comments
Open

proposal: add thread check for most of the not thread-safe methods #590

smartcmd opened this issue Feb 26, 2025 · 0 comments
Labels
Proposal Some important decisions

Comments

@smartcmd
Copy link
Member

smartcmd commented Feb 26, 2025

Problem

Since Allay is designed to be multi-thread between different worlds, it may be normal for plugin developers who are lack for multi-thread programming knowledges access not thread-safe methods in wrong threads unexpectedly. We need a mechanism to ensure plugin developers calling these methods correctly (in right thread), and throw exception when the caller is not in correct thread.

Solution

This proposal proposes an idea. To be detailed, we put check to these methods, and when they are called, the checker will check if the caller is in correct thread. This solution is similar to what Spigot/Paper did.

However, adding these checks may result in performance reduction. Maybe we can find a better solution.

@smartcmd smartcmd added the Proposal Some important decisions label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal Some important decisions
Projects
None yet
Development

No branches or pull requests

1 participant