-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
worker: add missing initialization #41421
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
Conversation
Add missing initialization reported by coverity Signed-off-by: Michael Dawson <[email protected]>
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.
uv_thread_t is an opaque type, we should not rely on the fact that 0 may currently be a valid initailizer for it.
Usage of tid_ is restricted to the condition that thread_joined_ is false, and conversely thread_joined_ is only set to false when tid_ is initialized. Consequently, this seems to be a false positive.
Edit: To be clear: This also reduces readability because initializing tid_ makes it looks like the variable can always be accessed, even when the thread is not running, which is not valid usage of it. However, I think we’re using C++17 now, so maybe we could drop thread_joined_ and instead make tid_ an std::optional<uv_thread_t>?
|
PR with that suggestion: #41453 |
|
Ok, I'll check the coverity report after the change proposed in #41453 and if it still reports an issue we can flag it as a false positive. |
Refs: #41421 PR-URL: #41453 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: #41421 PR-URL: #41453 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: nodejs#41421 PR-URL: nodejs#41453 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
|
#41453 seems to have resolve the warning, closing. |
Refs: nodejs#41421 PR-URL: nodejs#41453 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Refs: nodejs#41421 PR-URL: nodejs#41453 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
Add missing initialization reported by coverity
Signed-off-by: Michael Dawson [email protected]