The Thrift library has its own abstraction for mutexes, which
normally just a wrapper around `std::mutex` using the PIMPL
idiom (pointer-to-impl).
Since Zephyr does not yet support `std::mutex`, a workaround
was added in Zephyr that was essentially no-op, and actually
the PIMPL idiom made it quite easy to do that. However,
pretending there is no synchronization requirement is not a
solution for it.
We can't yet just use a `struct k_mutex` yet, because we
don't yet support userspace, but for now we can fake a mutex
interface with a spinlock.
We hope to eventually drop this workaround entirely and just
support `std::mutex`.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Previously, the binary protocol variant of ThriftTest would fail
consistently in CI for `qemu_x86_64` with the message below.
```
E: failed to poll fds -1, -1: 1
```
Note: 1 corresponds to EPERM
The root cause of this is that we do not yet have support for
standard synchronization primitives in C++, and there is
slightly racey behaviour in thrift until we do have support
for standard synchronization primitives.
With the addition of dynamic thread stacks, conforming pthreads,
and some additional work in the toolchain area
(re gthr-posix.h), we should soon be able to enable proper
synchronization primitives.
This change is a temporary workaround but solves the
test failure (which would occur even when tests all passed).
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Add glue code for the thrift module. This includes:
* workarounds for Zephyr's missing C++ facilities
* thrift config.h
This code was merged from the following repository
at the commit specified below, with minor formatting
and coding-style modifications.
https://github.com/zephyrproject-rtos/gsoc-2022-thrift
e12e014d295918cc5ba0b4c507d1bf595a2f539a
Signed-off-by: Chris Friedt <cfriedt@meta.com>