Skip to content

Commit 8e44180

Browse files
committed
Use managed thread in tests
1 parent d615464 commit 8e44180

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tests/secure_tunnel_tests.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ struct aws_secure_tunnel_mock_test_fixture {
144144
int error_code;
145145
} on_send_message_complete_result;
146146

147-
struct aws_thread host_resolver_thread;
148147
bool host_resolver_thread_executed;
149148
};
150149

@@ -1078,15 +1077,16 @@ int aws_websocket_client_connect_fail_in_another_thread_fn(
10781077
test_fixture->websocket_function_table->on_incoming_frame_payload_fn = options->on_incoming_frame_payload;
10791078
test_fixture->websocket_function_table->on_incoming_frame_complete_fn = options->on_incoming_frame_complete;
10801079

1081-
if (aws_thread_init(&test_fixture->host_resolver_thread, test_fixture->allocator)) {
1080+
struct aws_thread host_resolver_thread;
1081+
if (aws_thread_init(&host_resolver_thread, test_fixture->allocator)) {
10821082
AWS_LOGF_ERROR(AWS_LS_HTTP_WEBSOCKET_SETUP, "id=static: Failed to initialize thread.");
10831083
return aws_raise_error(AWS_ERROR_HTTP_UNKNOWN);
10841084
}
1085-
10861085
struct aws_thread_options thread_options = *aws_default_thread_options();
10871086
thread_options.name = aws_byte_cursor_from_c_str("HostResolver");
1087+
thread_options.join_strategy = AWS_TJS_MANAGED;
10881088

1089-
if (aws_thread_launch(&test_fixture->host_resolver_thread, s_host_resolver_thread, test_fixture, &thread_options) !=
1089+
if (aws_thread_launch(&host_resolver_thread, s_host_resolver_thread, test_fixture, &thread_options) !=
10901090
AWS_OP_SUCCESS) {
10911091
AWS_LOGF_ERROR(AWS_LS_HTTP_WEBSOCKET_SETUP, "id=static: Failed to launch thread.");
10921092
return aws_raise_error(AWS_ERROR_HTTP_UNKNOWN);
@@ -1145,9 +1145,6 @@ static int s_secure_tunneling_fail_ws_in_another_thread_test_fn(struct aws_alloc
11451145
s_wait_for_connection_failed(&test_fixture);
11461146
ASSERT_SUCCESS(aws_secure_tunnel_stop(secure_tunnel));
11471147

1148-
ASSERT_SUCCESS(aws_thread_join(&test_fixture.host_resolver_thread));
1149-
aws_thread_clean_up(&test_fixture.host_resolver_thread);
1150-
11511148
ASSERT_TRUE(test_fixture.host_resolver_thread_executed);
11521149

11531150
aws_secure_tunnel_mock_test_clean_up(&test_fixture);

0 commit comments

Comments
 (0)