aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/test/cpp/end2end/nonblocking_test.cc
diff options
context:
space:
mode:
authorheretic <heretic@yandex-team.ru>2022-02-10 16:45:43 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:43 +0300
commit397cbe258b9e064f49c4ca575279f02f39fef76e (patch)
treea0b0eb3cca6a14e4e8ea715393637672fa651284 /contrib/libs/grpc/test/cpp/end2end/nonblocking_test.cc
parent43f5a35593ebc9f6bcea619bb170394ea7ae468e (diff)
downloadydb-397cbe258b9e064f49c4ca575279f02f39fef76e.tar.gz
Restoring authorship annotation for <heretic@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/grpc/test/cpp/end2end/nonblocking_test.cc')
-rw-r--r--contrib/libs/grpc/test/cpp/end2end/nonblocking_test.cc48
1 files changed, 24 insertions, 24 deletions
diff --git a/contrib/libs/grpc/test/cpp/end2end/nonblocking_test.cc b/contrib/libs/grpc/test/cpp/end2end/nonblocking_test.cc
index 4be070ec71..bb54f17f03 100644
--- a/contrib/libs/grpc/test/cpp/end2end/nonblocking_test.cc
+++ b/contrib/libs/grpc/test/cpp/end2end/nonblocking_test.cc
@@ -39,18 +39,18 @@
#ifdef GRPC_POSIX_SOCKET
// Thread-local variable to so that only polls from this test assert
-// non-blocking (not polls from resolver, timer thread, etc), and only when the
-// thread is waiting on polls caused by CompletionQueue::AsyncNext (not for
-// picking a port or other reasons).
-GPR_TLS_DECL(g_is_nonblocking_poll);
+// non-blocking (not polls from resolver, timer thread, etc), and only when the
+// thread is waiting on polls caused by CompletionQueue::AsyncNext (not for
+// picking a port or other reasons).
+GPR_TLS_DECL(g_is_nonblocking_poll);
namespace {
int maybe_assert_non_blocking_poll(struct pollfd* pfds, nfds_t nfds,
int timeout) {
- // Only assert that this poll should have zero timeout if we're in the
- // middle of a zero-timeout CQ Next.
- if (gpr_tls_get(&g_is_nonblocking_poll)) {
+ // Only assert that this poll should have zero timeout if we're in the
+ // middle of a zero-timeout CQ Next.
+ if (gpr_tls_get(&g_is_nonblocking_poll)) {
GPR_ASSERT(timeout == 0);
}
return poll(pfds, nfds, timeout);
@@ -78,17 +78,17 @@ class NonblockingTest : public ::testing::Test {
}
bool LoopForTag(void** tag, bool* ok) {
- // Temporarily set the thread-local nonblocking poll flag so that the polls
- // caused by this loop are indeed sent by the library with zero timeout.
- intptr_t orig_val = gpr_tls_get(&g_is_nonblocking_poll);
- gpr_tls_set(&g_is_nonblocking_poll, static_cast<intptr_t>(true));
+ // Temporarily set the thread-local nonblocking poll flag so that the polls
+ // caused by this loop are indeed sent by the library with zero timeout.
+ intptr_t orig_val = gpr_tls_get(&g_is_nonblocking_poll);
+ gpr_tls_set(&g_is_nonblocking_poll, static_cast<intptr_t>(true));
for (;;) {
auto r = cq_->AsyncNext(tag, ok, gpr_time_0(GPR_CLOCK_REALTIME));
if (r == CompletionQueue::SHUTDOWN) {
- gpr_tls_set(&g_is_nonblocking_poll, orig_val);
+ gpr_tls_set(&g_is_nonblocking_poll, orig_val);
return false;
} else if (r == CompletionQueue::GOT_EVENT) {
- gpr_tls_set(&g_is_nonblocking_poll, orig_val);
+ gpr_tls_set(&g_is_nonblocking_poll, orig_val);
return true;
}
}
@@ -198,17 +198,17 @@ int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv);
::testing::InitGoogleTest(&argc, argv);
- gpr_tls_init(&g_is_nonblocking_poll);
-
- // Start the nonblocking poll thread-local variable as false because the
- // thread that issues RPCs starts by picking a port (which has non-zero
- // timeout).
- gpr_tls_set(&g_is_nonblocking_poll, static_cast<intptr_t>(false));
-
+ gpr_tls_init(&g_is_nonblocking_poll);
+
+ // Start the nonblocking poll thread-local variable as false because the
+ // thread that issues RPCs starts by picking a port (which has non-zero
+ // timeout).
+ gpr_tls_set(&g_is_nonblocking_poll, static_cast<intptr_t>(false));
+
int ret = RUN_ALL_TESTS();
- gpr_tls_destroy(&g_is_nonblocking_poll);
+ gpr_tls_destroy(&g_is_nonblocking_poll);
return ret;
-#else // GRPC_POSIX_SOCKET
- return 0;
-#endif // GRPC_POSIX_SOCKET
+#else // GRPC_POSIX_SOCKET
+ return 0;
+#endif // GRPC_POSIX_SOCKET
}