Skip to content

Commit 8fcc21d

Browse files
authored
Windows high performance counter precision fix; crt init/shutdown fix (aws#238)
* Windows high performance counter precision fix; crt init/shutdown fix * Submodule update
1 parent 8ac9a86 commit 8fcc21d

File tree

5 files changed

+44
-3
lines changed

5 files changed

+44
-3
lines changed

crt/aws-c-cal

source/Api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace Aws
5252

5353
ApiHandle::ApiHandle() noexcept : m_logger(), m_shutdownBehavior(ApiHandleShutdownBehavior::Blocking)
5454
{
55-
s_initApi(g_allocator);
55+
s_initApi(DefaultAllocator());
5656
}
5757

5858
ApiHandle::~ApiHandle()

tests/ApiTest.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0.
4+
*/
5+
#include <aws/crt/Api.h>
6+
#include <aws/crt/Types.h>
7+
#include <aws/testing/aws_test_harness.h>
8+
9+
static int s_TestApiMultiCreateDestroy(struct aws_allocator *allocator, void *)
10+
{
11+
{
12+
Aws::Crt::ApiHandle apiHandle(allocator);
13+
}
14+
15+
{
16+
Aws::Crt::ApiHandle apiHandle(allocator);
17+
}
18+
19+
return AWS_ERROR_SUCCESS;
20+
}
21+
22+
AWS_TEST_CASE(ApiMultiCreateDestroy, s_TestApiMultiCreateDestroy)
23+
24+
static int s_TestApiMultiDefaultCreateDestroy(struct aws_allocator *allocator, void *)
25+
{
26+
(void)allocator;
27+
28+
{
29+
Aws::Crt::ApiHandle apiHandle;
30+
}
31+
32+
{
33+
Aws::Crt::ApiHandle apiHandle;
34+
}
35+
36+
return AWS_ERROR_SUCCESS;
37+
}
38+
39+
AWS_TEST_CASE(ApiMultiDefaultCreateDestroy, s_TestApiMultiDefaultCreateDestroy)

tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ file(GLOB TESTS ${TEST_HDRS} ${TEST_SRC})
88

99
set(TEST_BINARY_NAME ${PROJECT_NAME}-tests)
1010

11+
add_test_case(ApiMultiCreateDestroy)
12+
add_test_case(ApiMultiDefaultCreateDestroy)
1113
add_test_case(EventLoopResourceSafety)
1214
add_test_case(ClientBootstrapResourceSafety)
1315
if (NOT BYO_CRYPTO)

0 commit comments

Comments
 (0)