bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cnd_timedout returns immediately when built with MinGW


From: Tim Rühsen
Subject: Re: cnd_timedout returns immediately when built with MinGW
Date: Sat, 6 Aug 2022 13:58:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0

Hi Bruno,

On 05.08.22 20:27, Bruno Haible wrote:
Hi Tim,

I am at switching wget2 multithreading from C99+glthreads to C11
(threads.h).

I hope that you have considered the Gnulib documentation on this topic:
https://www.gnu.org/software/gnulib/manual/html_node/Choosing-a-multithreading-API.html

Thanks for the pointer. I used the gnulib API in the past and created API wrappers for libwget, so that apps didn't need to use gnulib directly. Since Wget2 is the only app I know that uses libwget, I recently decided to go with ISO C (C11) in the future and drop the libwget thread API completely.

The rationale was
- gnulib is C11, so the libwget code is
- less code = less maintenance
- the library code just uses the basic thread, condition and mutex API

I read that even the MS C compilers / libraries support ISO C thread nowadays,
so ISO C seems OK to me.


The tests work well on Linux (amd64) (Debian unstable/testing/stable,
Fedora 35, Arch, Alpine/muslc) with native builds (gcc or clang).

But they completely fail when cross-building with MinGW64 (on Debian
bookworm).

And what's the execution environment? Is it Windows or is it wine? wine is
not supported; I've had enough work making it work on Windows.

Testing with wine, as I don't own a Windows license.
Have to carry a USB stick to a friend in order to test on real Windows (trying to avoid that).

And yeah, I can fully understand that wine isn't directly supported. It seems to be
a can of worms on it's own.

Also, are you configuring with --enable-threads=windows? If yes, then
it should work (on Windows). If not, then if the winpthreads library
is found, it will be used; but since this library is broken, some of the
tests will hang, crash, or fail. To avoid using this broken library,
add this macro invocation to your configure.ac:
   gl_AVOID_WINPTHREAD

'--enable-threads=windows' does not work with MinGW since 'threads.h' is not available via gnulib then. MinGW also doesn't provide it. It's not 100% clear to me what this option actually does.

I'll use gl_AVOID_WINPTHREAD since there are reports from Windows users regarding multi-threading not working
as expected (using the gnulib API).

Thank you, I appreciate your help & hints !

Regards, Tim


Bruno




Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]