Repository navigation
const is fine on ares__channel_[un]lock - #758
Merged
Merged
Conversation
Member
|
you're right, the thread implementation ended up mallocing a memory area for the OS-specific implementations rather than trying to create a system-specific typedef, such as to pthread_mutex_t (which would have made the original decision correct). |
Member
|
did you want to go ahead and sprinkle const on the relevant public functions with this PR too? |
Contributor
Author
|
sure, I can do that - might take me a day or two to get to it |
Collaborator
|
IIRC adding const changes the ABI on certain (probably obscure) platforms, but
it's possible my memory is failing me on that point.
|
Member
|
@dfandrich are you sure? I mean on C++ it might change name mangling, but that's not a concern with C. |
Collaborator
|
I have a vague recollection of problems with this years ago on some obscure
system and I can't for certain any more. It will be a few days before I can get
a chance to verify it, so go ahead if your information says otherwise.
|
Contributor
Author
|
updates pushed, pipeline green looks as though I am using a more recent version of clang-format than was previously used, but since the pipeline doesn't mind I have just let it do its thing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
at #601 (comment) you chose not to scatter
conston the public interface because of the plan - now realised - to add threading to c-ares, and in the expectation that even read operations would need to lock the mutex.But the threading implementation has a pointer to a mutex inside the ares channel and as I understand it, that means that it is just fine to mark
ares__channel_lock(andares__channel_unlock) as taking aconstchannel. It is the pointed-to mutex that is not constant, but C does not propagateconst-ness through pointers.Anyway here is a pull request limited to just that change, in the expectation that the pipelines will say so if I have misunderstood this.
This is not necessarily worth merging for itself, rather it is intended as a demonstration that - if you are still interested in it - #601 can be back on the table.