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

Bad share unlock documentation. #8573

Closed
folarte opened this issue Mar 10, 2022 · 1 comment
Closed

Bad share unlock documentation. #8573

folarte opened this issue Mar 10, 2022 · 1 comment

Comments

@folarte
Copy link

@folarte folarte commented Mar 10, 2022

https://curl.se/libcurl/c/CURLSHOPT_UNLOCKFUNC.html and https://curl.se/libcurl/c/CURLSHOPT_LOCKFUNC.html documentunlock_cb has having the same prototype as lockcb:

void unlockcb(CURL *handle, curl_lock_data data, curl_lock_access access, void *userptr);
void lockcb(CURL *handle, curl_lock_data data, curl_lock_access access, void *userptr);

But curl.h, in 7.82, defines them differently:

typedef void (*curl_lock_function)(CURL *handle,
curl_lock_data data,
curl_lock_access locktype,
void *userptr);
typedef void (*curl_unlock_function)(CURL *handle,
curl_lock_data data,
void *userptr);

Either one needs to be fixed. As they are taken via ... you can pass wrong functions and get extremely strange results, due to the C calling protocol allowing it. That kept me thinking for a while until I decided to grep the source.

IMO the prototype in the documentation is better, as RW locks, like the std::shared_mutex I was using, have different methods for shared and unshared locking. I can be coded around, just use the pair of the last successful lock that, but it is not trivial.

bagder added a commit that referenced this issue Mar 10, 2022
Copy and paste error

Fixes #8573
Reported-by: Francisco Olarte
@bagder
Copy link
Member

@bagder bagder commented Mar 10, 2022

The docs is wrong and will be updated. We can't change the actually used prototype without breaking existing applications.

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