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

Possible Improper Use of Lock Guard #271

Closed
DeveloperPaul123 opened this issue Nov 9, 2021 · 1 comment
Closed

Possible Improper Use of Lock Guard #271

DeveloperPaul123 opened this issue Nov 9, 2021 · 1 comment

Comments

@DeveloperPaul123
Copy link
Contributor

DeveloperPaul123 commented Nov 9, 2021

In profiling.cpp, the lock_guard variables are not named. My understanding is that this means they will be destroyed immediately which is probably not the intention for the RAII objects.

Example:

void point(const ::std::string& description, color_t color)
{
	::std::lock_guard<::std::mutex> { detail_::profiler_mutex };
	// logging?
	nvtxEventAttributes_t eventAttrib = {0};
	eventAttrib.version = NVTX_VERSION;
	eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
	eventAttrib.colorType = NVTX_COLOR_ARGB;
	eventAttrib.color = color;
	eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
	eventAttrib.message.ascii = description.c_str();
	nvtxMarkEx(&eventAttrib);
}

This was caught by a clang warning.

@eyalroz
Copy link
Owner

eyalroz commented Nov 9, 2021

My understanding is that this means they will be destroyed immediately

Are you sure? ... hmm, that clang warning seems to suggest that might be the case. Weird.

eyalroz added a commit that referenced this issue Nov 9, 2021
@eyalroz eyalroz self-assigned this Nov 9, 2021
eyalroz added a commit that referenced this issue Nov 9, 2021
eyalroz added a commit that referenced this issue Nov 9, 2021
eyalroz added a commit that referenced this issue Nov 9, 2021
eyalroz added a commit that referenced this issue Nov 13, 2021
eyalroz added a commit that referenced this issue Dec 4, 2021
eyalroz added a commit that referenced this issue Dec 10, 2021
eyalroz added a commit that referenced this issue Jan 14, 2022
@eyalroz eyalroz closed this as completed Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants