You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that proposal introduces a hideous piece of code I rather not have in an example we provide showing off libcurl with.
Seems harsh. POSIX allows pthread_t to be opaque so the way we cast it to long for thread id will not always work, like for PThreads4W as we can see here. How about a comment that explains this situation:
diff --git a/docs/examples/threaded-ssl.c b/docs/examples/threaded-ssl.c
index f58e447..4feea80 100644
--- a/docs/examples/threaded-ssl.c+++ b/docs/examples/threaded-ssl.c@@ -65,6 +65,8 @@ static unsigned long thread_id(void)
{
unsigned long ret;
+ /* How to obtain the thread ID will vary depending on the pthreads library+ you are using. This example assumes pthread_self returns the ID. */
ret = (unsigned long)pthread_self();
return ret;
}
I did this
Compiling
docs/examples/threaded-ssl.c
using POSIX threads for Windows orPThreads4W, gives me this compile error (from clang-cl):
This is caused by
pthread_t
which is a structure on Pthreads4W.But with this patch, it compiles:
And the program works.
I expected the following
A successful compile.
curl/libcurl version
operating system
Win-10.
The text was updated successfully, but these errors were encountered: