I see a compilation warning due to potentially problematic code due to combining hiredis and C++:
In file included from /usr/include/hiredis/hiredis.h:40,
from heartbeat.h:8,
from thread.h:4,
from thread.cpp:1:
/usr/include/hiredis/sds.h:48:10: warning: ISO C++ forbids flexible array member ‘buf’ [-Wpedantic]
48 | char buf[];
| ^~~
/usr/include/hiredis/sds.h:54:10: warning: ISO C++ forbids flexible array member ‘buf’ [-Wpedantic]
54 | char buf[];
| ^~~
/usr/include/hiredis/sds.h:60:10: warning: ISO C++ forbids flexible array member ‘buf’ [-Wpedantic]
60 | char buf[];
| ^~~
/usr/include/hiredis/sds.h:66:10: warning: ISO C++ forbids flexible array member ‘buf’ [-Wpedantic]
66 | char buf[];
| ^~~
/usr/include/hiredis/sds.h:72:10: warning: ISO C++ forbids flexible array member ‘buf’ [-Wpedantic]
72 | char buf[];
| ^~~
This would be eliminated by using C everywhere, which might involve moving to use https://tinycthread.github.io/ for the threading.
The C++ might throw and that will end poorly! We need to put all the C++ code into a try/catch block
We could rewrite the whole package in C++ using cpp11, but that leaves the first issue unresolved
There are a couple of issues here:
This would be eliminated by using C everywhere, which might involve moving to use https://tinycthread.github.io/ for the threading.