[Proposal/Testing Request] Use WIN32 mutex locks on Windows

36 views
Skip to first unread message

Konstantin Podsvirov

unread,
Aug 9, 2021, 12:25:46 PM8/9/21
to SpatiaLite Users
Different builds based on mingw/clang available now for libspatialite and spatialite-tools via MSYS2 distro.

Suggested (patch in builds) changes is described in Ticket.

Please check the available builds and report if there are any problems.

PS: Alessandro, can we discuss themes like this in this list?

--
Regards,
Konstantin Podsvirov

Alessandro Furieri

unread,
Aug 11, 2021, 12:45:30 PM8/11/21
to SpatiaLite Users
Hi Konstantin,

> PS: Alessandro, can we discuss themes like this in this list?
>

why not ? we'll immediately start

just few quick comments about your proposed patch:

1. using semaphores was strictly required by older versions
   of GEOS that weren't safely reentrant thus causing endless
   troubles to multithreded applications.
   but starting from GEOS v.3.5.0 (released on August 2015)
   GEOS is now fully reentrant, so these portions of code
   are no longer useful and are still preserved just not to
   break legacy support for obsolete versions of GEOS
   (please look at the conditional GEOS_REENTRANT set by  
   ./configure)
   
2. the basic idea was to use libpthread on Linux and MinGW
   switching to the Windows native CriticalSection only
   when using the MSVC compiler.
   
3. I've never used the clang compiler on Windows, but I 
   easily imagine that it has problems in supporting
   libpthreads; do you confirm ?
   
short conclusion: always using the Windows native
semaphores instead of the ones supported by pthreads
seems to be a more portable solution.
I've absolutely no objections in this case (mainly
because we are talking about "dead code" no longer
required), but I'm afraid for other libraries like 
librasterlite2 that make a wider use of multithreading. 
switching from libpthread to Windows native support 
could be a little bit harder.

just for my personal curiosity, please explain in
more depth where are the troubles for the clang
compiler.

bye Sandro

Konstantin Podsvirov

unread,
Aug 11, 2021, 1:55:42 PM8/11/21
to SpatiaLite Users
Answer from original PR:

clang on windows can support libpthreads, via the winpthreads package from mingw-w64, same as GCC. But, the clang prefixes here are configured so that libc++ uses native windows threads instead, so winpthreads is not pulled along automatically by things linking to the C++ runtime as it is with gcc.



среда, 11 августа 2021 г. в 19:45:30 UTC+3, Alessandro Furieri:
Reply all
Reply to author
Forward
0 new messages