diff --git a/td/telegram/Client.cpp b/td/telegram/Client.cpp index 9c760947a..78094090a 100644 --- a/td/telegram/Client.cpp +++ b/td/telegram/Client.cpp @@ -13,7 +13,6 @@ #include "td/utils/crypto.h" #include "td/utils/logging.h" #include "td/utils/MpscPollableQueue.h" -#include "td/utils/port/Poll.h" #include "td/utils/port/PollFlags.h" #include "td/utils/port/thread.h" diff --git a/tdutils/td/utils/MpscPollableQueue.h b/tdutils/td/utils/MpscPollableQueue.h index 251d4428a..7c5561845 100644 --- a/tdutils/td/utils/MpscPollableQueue.h +++ b/tdutils/td/utils/MpscPollableQueue.h @@ -13,11 +13,6 @@ #include "td/utils/SpinLock.h" -#if !TD_WINDOWS -#include -#include -#endif - #include namespace td { @@ -79,21 +74,14 @@ class MpscPollableQueue { } } -// Just example of usage -#if !TD_WINDOWS + // Just an example of usage int reader_wait() { int res; - while ((res = reader_wait_nonblock()) == 0) { - // TODO: reader_flush? - pollfd fd; - fd.fd = reader_get_event_fd().get_poll_info().native_fd().fd(); - fd.events = POLLIN; - poll(&fd, 1, -1); + reader_get_event_fd().wait(1000); } return res; } -#endif private: SpinLock lock_; diff --git a/tdutils/td/utils/port/detail/EventFdBsd.cpp b/tdutils/td/utils/port/detail/EventFdBsd.cpp index 1d969e7ff..d46e5833c 100644 --- a/tdutils/td/utils/port/detail/EventFdBsd.cpp +++ b/tdutils/td/utils/port/detail/EventFdBsd.cpp @@ -17,9 +17,9 @@ char disable_linker_warning_about_empty_file_event_fd_bsd_cpp TD_UNUSED; #include "td/utils/Slice.h" #include +#include #include #include -#include namespace td { namespace detail { diff --git a/tdutils/td/utils/port/detail/EventFdLinux.cpp b/tdutils/td/utils/port/detail/EventFdLinux.cpp index 574395879..2f1794fd1 100644 --- a/tdutils/td/utils/port/detail/EventFdLinux.cpp +++ b/tdutils/td/utils/port/detail/EventFdLinux.cpp @@ -17,8 +17,8 @@ char disable_linker_warning_about_empty_file_event_fd_linux_cpp TD_UNUSED; #include "td/utils/Slice.h" #include -#include #include +#include namespace td { namespace detail { diff --git a/tdutils/td/utils/queue.h b/tdutils/td/utils/queue.h index 6561a458f..fc3ec0a77 100644 --- a/tdutils/td/utils/queue.h +++ b/tdutils/td/utils/queue.h @@ -11,11 +11,6 @@ #if !TD_THREAD_UNSUPPORTED && !TD_EVENTFD_UNSUPPORTED -#if !TD_WINDOWS -#include -#include -#endif - #include #include #include @@ -393,18 +388,14 @@ class PollQueue : public QueueT { return res; } -// Just example of usage -#if !TD_WINDOWS + // Just an example of usage int reader_wait() { int res; - while ((res = reader_wait_nonblock()) == 0) { - // TODO: reader_flush? reader_get_event_fd().wait(1000); } return res; } -#endif private: EventFd event_fd_; diff --git a/tdutils/test/port.cpp b/tdutils/test/port.cpp index 7d5e08a6b..ab143143e 100644 --- a/tdutils/test/port.cpp +++ b/tdutils/test/port.cpp @@ -35,7 +35,7 @@ TEST(Port, files) { const int ITER_COUNT = 1000; for (int i = 0; i < ITER_COUNT; i++) { walk_path(main_dir, - [&](CSlice name, bool is_directory) mutable { + [&](CSlice name, bool is_directory) { if (!is_directory) { ASSERT_TRUE(name == fd_path || name == fd2_path); }