1 #ifndef ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H 2 #define ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H 3 4 #include <android/hardware/tests/multithread/1.0/IMultithread.h> 5 #include <hidl/Status.h> 6 7 #include <chrono> 8 #include <condition_variable> 9 #include <mutex> 10 11 namespace android { 12 namespace hardware { 13 namespace tests { 14 namespace multithread { 15 namespace V1_0 { 16 namespace implementation { 17 18 using ::android::hardware::tests::multithread::V1_0::IMultithread; 19 using ::android::hardware::Return; 20 using ::android::hardware::Void; 21 22 using namespace std::chrono_literals; 23 24 struct Multithread : public IMultithread { 25 // Methods from ::android::hardware::tests::multithread::V1_0::IMultithread follow. 26 virtual Return<void> setNumThreads(int32_t maxThreads, int32_t numThreads) override; 27 virtual Return<bool> runNewThread() override; 28 29 private: 30 int32_t mNumThreads; 31 bool mNoTimeout; 32 33 std::condition_variable mCv; 34 std::mutex mCvMutex; 35 36 static constexpr auto kTimeoutDuration = 100ms; 37 }; 38 39 extern "C" IMultithread* HIDL_FETCH_IMultithread(const char* name); 40 41 } // namespace implementation 42 } // namespace V1_0 43 } // namespace multithread 44 } // namespace tests 45 } // namespace hardware 46 } // namespace android 47 48 #endif // ANDROID_HARDWARE_TESTS_MULTITHREAD_V1_0_MULTITHREAD_H 49