Undo move_as_native_fd changes.

This commit is contained in:
levlam 2020-12-24 18:43:26 +03:00
parent 1b92e2d57a
commit b582eb346a
2 changed files with 2 additions and 6 deletions

View File

@ -24,7 +24,6 @@ namespace td {
template <int id> template <int id>
static FileFd &get_file_fd() { static FileFd &get_file_fd() {
static FileFd result = FileFd::from_native_fd(NativeFd(id, true)); static FileFd result = FileFd::from_native_fd(NativeFd(id, true));
static ExitGuard exit_guard;
static auto guard = ScopeExit() + [&] { static auto guard = ScopeExit() + [&] {
result.move_as_native_fd().release(); result.move_as_native_fd().release();
}; };

View File

@ -7,7 +7,6 @@
#pragma once #pragma once
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/ExitGuard.h"
#include "td/utils/format.h" #include "td/utils/format.h"
#include "td/utils/List.h" #include "td/utils/List.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
@ -125,10 +124,8 @@ class PollableFdInfo : private ListNode {
~PollableFdInfo() { ~PollableFdInfo() {
VLOG(fd) << native_fd() << " destroy PollableFdInfo"; VLOG(fd) << native_fd() << " destroy PollableFdInfo";
if (!ExitGuard::is_exited()) { bool was_locked = lock_.test_and_set(std::memory_order_acquire);
bool was_locked = lock_.test_and_set(std::memory_order_acquire); CHECK(!was_locked);
CHECK(!was_locked);
}
} }
void add_flags_from_poll(PollFlags flags) { void add_flags_from_poll(PollFlags flags) {