Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup aws-lc thread locals in event loop threads #581

Merged
merged 7 commits into from
Jun 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions source/linux/epoll_event_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,14 @@ static int aws_event_loop_listen_for_io_events(int epoll_fd, struct epoll_event
return epoll_wait(epoll_fd, events, MAX_EVENTS, timeout);
}

static void s_aws_cleanup_aws_lc_thread_local_state(void *user_data) {
(void)user_data;

#if defined(OPENSSL_IS_AWSLC)
AWSLC_thread_local_clear();
bretambrose marked this conversation as resolved.
Show resolved Hide resolved
#endif
}

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);
Expand All @@ -576,6 +584,8 @@ static void aws_event_loop_thread(void *args) {
return;
}

aws_thread_current_at_exit(s_aws_cleanup_aws_lc_thread_local_state, NULL);
bretambrose marked this conversation as resolved.
Show resolved Hide resolved

int timeout = DEFAULT_TIMEOUT;

struct epoll_event events[MAX_EVENTS];
Expand Down