mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
This was flaking in infra. I wasn't able to reproduce offline. Yes, this code directly affects a test in system/tools/hidl git project. Bug: 309428730 Test: atest hidl_test Change-Id: Id8eef9f84f208d5c5de739869fe56603da9dc141
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#ifndef ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H
|
|
#define ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H
|
|
|
|
#include <android/hardware/tests/multithread/1.0/IMultithread.h>
|
|
#include <hidl/Status.h>
|
|
|
|
#include <chrono>
|
|
#include <condition_variable>
|
|
#include <mutex>
|
|
|
|
namespace android {
|
|
namespace hardware {
|
|
namespace tests {
|
|
namespace multithread {
|
|
namespace V1_0 {
|
|
namespace implementation {
|
|
|
|
using ::android::hardware::tests::multithread::V1_0::IMultithread;
|
|
using ::android::hardware::Return;
|
|
using ::android::hardware::Void;
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
struct Multithread : public IMultithread {
|
|
// Methods from ::android::hardware::tests::multithread::V1_0::IMultithread follow.
|
|
virtual Return<void> setNumThreads(int32_t maxThreads, int32_t numThreads) override;
|
|
virtual Return<bool> runNewThread() override;
|
|
|
|
private:
|
|
int32_t mNumThreads;
|
|
bool mNoTimeout;
|
|
|
|
std::condition_variable mCv;
|
|
std::mutex mCvMutex;
|
|
|
|
static constexpr auto kTimeoutDuration = 1000ms;
|
|
};
|
|
|
|
extern "C" IMultithread* HIDL_FETCH_IMultithread(const char* name);
|
|
|
|
} // namespace implementation
|
|
} // namespace V1_0
|
|
} // namespace multithread
|
|
} // namespace tests
|
|
} // namespace hardware
|
|
} // namespace android
|
|
|
|
#endif // ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H
|