-
Notifications
You must be signed in to change notification settings - Fork 56
Add init functions to support thread safe init of impls #102
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1c162bb
bump builder
DmitriyMusatkin 7e048fb
undo
DmitriyMusatkin 55b5155
stray /
DmitriyMusatkin f1cfdc8
up the ver
DmitriyMusatkin 9b0c5af
add init functions
DmitriyMusatkin ff66ac8
missed header
DmitriyMusatkin 279de1e
maybe less typos
DmitriyMusatkin e1521fc
fix prototypes
DmitriyMusatkin 6d12c03
typo
DmitriyMusatkin c0d608e
build error
DmitriyMusatkin 1ac26b2
fix header
DmitriyMusatkin ba79773
more voids
DmitriyMusatkin 76ac0a0
address comments
DmitriyMusatkin c47ed32
Update source/checksums.c
DmitriyMusatkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef AWS_CHECKSUMS_CHECKSUMS_H | ||
#define AWS_CHECKSUMS_CHECKSUMS_H | ||
|
||
#include <aws/common/common.h> | ||
|
||
#include <aws/checksums/exports.h> | ||
|
||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
/** | ||
* Initializes internal data structures used by aws-checksums. | ||
* MUST be called before using any functionality in aws-checksums. | ||
* Note: historically aws-checksums lazily initialized stuff and things worked without init. | ||
* However, DO NOT rely on that behavior and explicitly call init instead. | ||
*/ | ||
AWS_CHECKSUMS_API void aws_checksums_library_init(struct aws_allocator *allocator); | ||
|
||
/** | ||
* Shuts down the internal data structures used by aws-checksums. | ||
*/ | ||
AWS_CHECKSUMS_API void aws_checksums_library_clean_up(void); | ||
|
||
#endif /* AWS_CHECKSUMS_CHECKSUMS_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
#include <aws/checksums/checksums.h> | ||
#include <aws/checksums/private/crc_util.h> | ||
|
||
static bool s_checksums_library_initialized = false; | ||
|
||
void aws_checksums_library_init(struct aws_allocator *allocator) { | ||
if (!s_checksums_library_initialized) { | ||
s_checksums_library_initialized = true; | ||
|
||
aws_common_library_init(allocator); | ||
|
||
aws_checksums_crc32_init(); | ||
aws_checksums_crc64_init(); | ||
} | ||
} | ||
|
||
void aws_checksums_library_clean_up(void) { | ||
if (s_checksums_library_initialized) { | ||
s_checksums_library_initialized = false; | ||
aws_common_library_clean_up(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.