There was a sub-optimality in the CAS operation. vjpai@ and
I decided to move to std::atomic.
This commit basically moves CQ data to C++ structures, and
makes grpc_cq_event_queue a proper c++ class called CQEventQueue.
Makes the public UserState property non-virtual and adds a protected
virtual UserStateCore that can be overridden. This follows the pattern
of the other members.
GCC allows this, but notably clang does not. Other systems,
like FreeBSD and some Linux distros ship with clang as default
compiler. While here, switch the approach to filtering out std
flag since the make workaround relies on GNU make syntax and
'make' binary could be bmake and/or gmake could be absent.
The idea to filter the flags was taken from an answer to this
Stack Overflow question:
https://stackoverflow.com/questions/15527611/how-do-i-specify-different-compiler-flags-in-distutils-for-just-one-python-c-ext
We are planning to enable -Wextra-semi flag in our project but some
header files in gRPC have extra semicolons that violates the check and
blocks us from enabling the flag.
This change removes unnecessary semicolons in the code. Note that having
semicolon after the GRPC_ABSTRACT macro technically also violates the
check, but it's fine for us since they are not used in public headers,
and it will be confusing to have lines ending only with GRPC_ABSTRACT,
so I keep them as-is.
Although it is spelling mistakes, it might make an affects while reading docs.
Co-Authored-By: Nguyen Phuong An <AnNP@vn.fujitsu.com>
Signed-off-by: Kim Bao Long <longkb@vn.fujitsu.com>
Clang doesn't support adapting calling convention when converting a
non-capturing lambda into a function pointer, and it doesn't
support tagging a lambda with calling convention AFAICT. In
thd_windows.cc, we create the thread body lambda and pass it to
CreateThread(), which fails to build on clang because it cannot
convert the lambda into stdcall function. Note that this bug only
happens when building for x32 architecture. x64 is not affected because
there is only one standard x64 calling convention.
This change fixes this by moving the thread body logic into a private
static method and tagging it with WINAPI (which expands to __stdcall).