ZeroMQ works and MINGW and pthread conditional variables if pthread
mutexes are used. POSIX conditional variables require POSIX mutexes, but
ZeroMQ unconditionally uses WIN32 critital sections even when configured
with pthread conditional variables. This of course does not work. This
patch fixes the build so that MINGW builds do not use WIN32 critical
sections and instead use POSIX mutexes when configured with pthread
conditional variables.
Tested with:
```
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ ../libzmq/configure --host=x86_64-w64-mingw32 --prefix=`pwd`/stage --enable-debug --disable-Werror --enable-libunwind=no --with-cv-impl=pthread --enable-libbsd=no
```
```
x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc (GCC) 10.2.0.....
```
* Problem: exception thrown when debugging
cl.exe x64 build with LLDB
Solution: Use __try __except with cl.exe and
use pthread_setname_np with MinGW.
Remove usage of pushing exception handler
to TIB->ExceptionList.
* Problem: No direct support for setting socket priority
Solution: Add ZMQ_PRIORITY socket option, which sets the
SO_PRIORITY socket option on the underlying socket. This
socket option is not supported under Windows. Check option
and set socket option on creation of underlying socket.
Don't include bsd/string.h if strlcpy is also defined in string.h to
avoid the following build failure on uclibc:
In file included from src/compat.hpp:41:0,
from src/ipc_address.cpp:31:
/tmp/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/bsd/string.h:44:54: error: declaration of 'size_t strlcpy(char*, const char*, size_t)' has a different exception specifier
size_t strlcpy(char *dst, const char *src, size_t siz);
^
In file included from src/compat.hpp:34:0,
from src/ipc_address.cpp:31:
/tmp/instance-0/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/string.h:424:15: error: from previous declaration 'size_t strlcpy(char*, const char*, size_t) throw ()'
extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
^
Fixes:
- http://autobuild.buildroot.org/results/51220b1b82774e8f6f6ed8593c58d2e3c31a1531
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
* remove override instructions to avoid a chain reaction with other overridden functions missing it
Co-authored-by: Stéphane Valès <stephane@vales.fr@users.noreply.github.com>
Co-authored-by: stephane vales <vales@ingenuity.io>
* Problem : if socket is invalid for any reason, as_socket_base_t() will return NULL and 'as_socket_base_t (items_[i].socket)->is_thread_safe ()' will crash
Solution: expand the code to test the returned value from as_socket_base_t() before calling is_thread_safe() and make zmq_poll() return -1 if as_socket_base_t() returned NULL.
NB: this occurred on the destruction of a SUB socket while running a zloop and without previously calling zloop_reader_set_tolerant and zloop_reader_end. When entering zmq_poll, the PUB socket was already destroyed but still registered in the poll items.
NB: making zmq_poll return -1 is OK as it is what happens anyway, and errno is properly set to ENOTSOCK by as_socket_base_t() when it returns NULL.
Co-authored-by: Stéphane Valès <stephane@vales.fr@users.noreply.github.com>
* Modifications to compile code for WINDOWS ARM and ARM64
[why]
In order to compile ZMQ related software on WINDOWS ARM
[how]
Replaced code in the file clock.cpp around the line 240.
Added intrinsics for ARM to replace '__rdtsc'
[todo]
Find proper tick counter query for ARM64 (see file:clock.cpp,line:~250)
* RELICENSEing
[why]
To make usage of changed code properly usable by libzmq project team
[how]
Added file /RELICENSE/kalantar.md with necessary information
Solution: check if a session's _pipe has been allocated before using
it, since as a consequence of creating the pipes after the handshake
it's no longer guaranteed to be there.
Fixes#3971