123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #ifndef _FASTDDS_RTPS_RESOURCES_ASYNCWRITERTHREAD_H_
- #define _FASTDDS_RTPS_RESOURCES_ASYNCWRITERTHREAD_H_
- #include <thread>
- #include <atomic>
- #include <list>
- #include <fastdds/rtps/resources/AsyncInterestTree.h>
- #include <fastrtps/utils/TimedMutex.hpp>
- #include <fastrtps/utils/TimedConditionVariable.hpp>
- namespace eprosima {
- namespace fastrtps {
- namespace rtps {
- class RTPSWriter;
- class AsyncWriterThread
- {
- public:
- AsyncWriterThread() = default;
- ~AsyncWriterThread();
-
- void unregister_writer(
- RTPSWriter* writer);
-
- void wake_up(
- RTPSWriter* interested_writer);
-
- void wake_up(
- RTPSWriter* interested_writer,
- const std::chrono::time_point<std::chrono::steady_clock>& max_blocking_time);
- private:
- AsyncWriterThread(const AsyncWriterThread&) = delete;
- const AsyncWriterThread& operator=(const AsyncWriterThread&) = delete;
-
- void run();
- std::thread* thread_ = nullptr;
- RecursiveTimedMutex condition_variable_mutex_;
-
- AsyncInterestTree interestTree_;
- bool running_ = false;
- bool run_scheduled_ = false;
- TimedConditionVariable cv_;
- };
- }
- }
- }
- #endif
|