aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/aws/aws-c-io/source/linux
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-01-13 11:39:51 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-01-13 11:39:51 +0300
commit7c44ed5547e5ffd0dfcea1db3c1ac97a4b5f901a (patch)
tree78a67c079d402182fdbd6c13105281828ec64750 /contrib/restricted/aws/aws-c-io/source/linux
parent1d7ce7e954244f52dc1e3e0a4eb0ad2adc3ea67b (diff)
downloadydb-7c44ed5547e5ffd0dfcea1db3c1ac97a4b5f901a.tar.gz
Update contrib/restricted/aws/aws-c-io to 0.13.12
Diffstat (limited to 'contrib/restricted/aws/aws-c-io/source/linux')
-rw-r--r--contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c b/contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c
index c7ad9251a3..151ffef9c1 100644
--- a/contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c
+++ b/contrib/restricted/aws/aws-c-io/source/linux/epoll_event_loop.c
@@ -60,7 +60,7 @@ static int s_unsubscribe_from_io_events(struct aws_event_loop *event_loop, struc
static void s_free_io_event_resources(void *user_data);
static bool s_is_on_callers_thread(struct aws_event_loop *event_loop);
-static void s_main_loop(void *args);
+static void aws_event_loop_thread(void *args);
static struct aws_event_loop_vtable s_vtable = {
.destroy = s_destroy,
@@ -272,7 +272,9 @@ static int s_run(struct aws_event_loop *event_loop) {
epoll_loop->should_continue = true;
aws_thread_increment_unjoined_count();
- if (aws_thread_launch(&epoll_loop->thread_created_on, &s_main_loop, event_loop, &epoll_loop->thread_options)) {
+ if (aws_thread_launch(
+ &epoll_loop->thread_created_on, &aws_event_loop_thread, event_loop, &epoll_loop->thread_options)) {
+
aws_thread_decrement_unjoined_count();
AWS_LOGF_FATAL(AWS_LS_IO_EVENT_LOOP, "id=%p: thread creation failed.", (void *)event_loop);
epoll_loop->should_continue = false;
@@ -547,7 +549,20 @@ static void s_process_task_pre_queue(struct aws_event_loop *event_loop) {
}
}
-static void s_main_loop(void *args) {
+/**
+ * This just calls epoll_wait()
+ *
+ * We broke this out into its own function so that the stacktrace clearly shows
+ * what this thread is doing. We've had a lot of cases where users think this
+ * thread is deadlocked because it's stuck here. We want it to be clear
+ * that it's doing nothing on purpose. It's waiting for events to happen...
+ */
+AWS_NO_INLINE
+static int aws_event_loop_listen_for_io_events(int epoll_fd, struct epoll_event events[MAX_EVENTS], int timeout) {
+ return epoll_wait(epoll_fd, events, MAX_EVENTS, timeout);
+}
+
+static void aws_event_loop_thread(void *args) {
struct aws_event_loop *event_loop = args;
AWS_LOGF_INFO(AWS_LS_IO_EVENT_LOOP, "id=%p: main loop started", (void *)event_loop);
struct epoll_loop *epoll_loop = event_loop->impl_data;
@@ -586,7 +601,7 @@ static void s_main_loop(void *args) {
while (epoll_loop->should_continue) {
AWS_LOGF_TRACE(AWS_LS_IO_EVENT_LOOP, "id=%p: waiting for a maximum of %d ms", (void *)event_loop, timeout);
- int event_count = epoll_wait(epoll_loop->epoll_fd, events, MAX_EVENTS, timeout);
+ int event_count = aws_event_loop_listen_for_io_events(epoll_loop->epoll_fd, events, timeout);
aws_event_loop_register_tick_start(event_loop);
AWS_LOGF_TRACE(