-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Fix quitting issue again #1876
base: main
Are you sure you want to change the base?
Fix quitting issue again #1876
Conversation
Warning Rate limit exceeded@malucard has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 11 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughThis pull request introduces a termination mechanism for the system. A new boolean flag Changes
Sequence Diagram(s)sequenceDiagram
participant OS as Operating System
participant Main as Main Function
participant System as System Class
OS->>Main: SIGINT/SIGTERM Received
Main->>Main: Call handleSignal(signal)
Main->>System: system->terminateSignalSafe()
System->>System: Set m_terminating = true, m_running = false
Main->>System: Check terminating() in resume()
System-->>Main: Returns true
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/main.cc (1)
169-171
: Well-designed signal handler function.This centralized signal handler function simplifies the code by providing a single place to handle termination signals, making it easier to maintain.
Consider using a more specific parameter type instead of
auto
:-void handleSignal(auto signal) { +void handleSignal(int signal) {
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/core/system.h
(3 hunks)src/main/main.cc
(3 hunks)
🔇 Additional comments (6)
src/core/system.h (4)
169-169
: Good addition of termination state accessor.This accessor method allows checking the termination state, which complements the existing
running()
andquitting()
methods for a more comprehensive state tracking system.
178-178
: Prevents resuming during termination.This check appropriately prevents the system from resuming if it's in a terminating state, which helps ensure clean shutdown.
183-187
: Well-designed signal-safe termination method.The implementation correctly uses a simple flag switch which is safe to use in signal handlers. The comment accurately explains the safety constraints of signal handlers, and the method properly updates both the termination state and running state.
268-268
: Good initialization of termination flag.The termination flag is properly initialized to false, consistent with other state flags in the class.
src/main/main.cc (2)
200-201
: Simplified signal registration.The signal handler registration is now cleaner and uses the dedicated function rather than lambdas, which improves readability.
461-464
: Effective termination check in main loop.This termination check ensures that signals can terminate the application regardless of whether the emulation is running or paused, effectively fixing the issue described in the PR.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1876 +/- ##
=======================================
Coverage 9.25% 9.25%
=======================================
Files 467 467
Lines 144566 144574 +8
=======================================
+ Hits 13386 13387 +1
- Misses 131180 131187 +7 ☔ View full report in Codecov by Sentry. |
In the other PR I fixed the signal handler, but I missed that it only caught signals when the emulation was paused, so here I moved the flag to the system class and made it turn off m_running, now it works as expected