thread cross platform#366
Conversation
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
Walkthrough将 Changes线程启动与初始化同步改造
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/ege_head.h`:
- Line 218: `graph_setting` contains a `std::thread threadui` that is started by
`initgraph()` but has no visible shutdown path, so it can still be joinable when
the object is destroyed and trigger termination. Update the `graph_setting`
lifecycle to stop the UI/message loop before exit, then explicitly `join()`
`threadui` (or otherwise safely handle its ownership) in the teardown path so
the thread is always cleaned up before destruction.
In `@src/graphics.cpp`:
- Around line 893-897: `initgraph()` currently waits only for `has_init ==
true`, so if `messageloopthread()` exits early from `init_instance()` failure
the wait can block forever. Update the initialization handshake in
`messageloopthread()` to always set a protected failure/ready state and call
`has_init_cv.notify_one()` on failure, preferably via a dedicated `init_failed`
or `init_status` field rather than reusing `exit_window`. Then change the wait
in `initgraph()` to detect that failure state, abort initialization, and skip
any follow-up work such as `UpdateWindow(pg->hwnd)`.
- Around line 979-983: `has_init` is currently written under `pg->has_init_mut`
in `graphics.cpp` but read without the same synchronization in `egegapi.cpp` and
`window.cpp`, creating an inconsistent concurrency contract. Update the
`has_init` access pattern so every read and write goes through the same
synchronization mechanism, either by making `has_init` atomic or by
encapsulating it behind the existing lock/state helpers used in
`isinitialized()`, `getbkcolor()`, `setbkcolor_f()`, `setcaption()`, and
`seticon()`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6ad5b57d-8ba7-4fb9-8137-75f533a8197a
📒 Files selected for processing (2)
src/ege_head.hsrc/graphics.cpp
f1ee67f to
5da803c
Compare
Summary by CodeRabbit