Repository navigation
RDKEMW-15488: Remove per-call mutex/cv allocation in MainThread - #634
Conversation
|
Pull request title must follow the pattern: Pull request description must follow the Commit message format for RDK-E:
< JIRA TICKET >: < one line summary of change less than 65 characters > |
There was a problem hiding this comment.
🟢 Approval recommended
Completion remains synchronized before thread-local state can be reused or destroyed, and no blocking issues remain.
0 open findings
What changed in this PR
Reduces allocation overhead in MainThread’s synchronous task submission by reusing thread-local completion state.
Changes:
- Reuses a mutex and condition variable for each calling thread in both blocking enqueue methods.
- Updates task completion signaling to use the shared completion-state structure.
| File | Description |
|---|---|
| media/server/main/source/MainThread.cpp | Reuses thread-local state for blocking calls and completion signaling. |
| media/server/main/include/MainThread.h | Adds TaskState and replaces per-task synchronization pointers. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Coverage statistics of your commit: |
ff7aefa to
aa892ce
Compare
A calling thread will be blocked inside enqueueTaskAndWait/enqueuePriorityTaskAndWait until the task completes, so we can reuse one mutex/cv per thread instead of allocating them for every call. This will avoid unnecessary heap allocations for std::mutex and std::condition_variable.
aa892ce to
d8d6042
Compare
|
Coverage statistics of your commit: |
1 similar comment
|
Coverage statistics of your commit: |
|
Coverage statistics of your commit: |
Summary: Remove per-call mutex/cv allocation in MainThread
Type: Fix
Test Plan: UT/CT, Fullstack
Jira: RDKEMW-15488