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

Unlink shutdown callback from ref count #1166

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 1 addition & 7 deletions include/aws/common/ref_count.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
#include <aws/common/common.h>

#include <aws/common/atomics.h>
#include <aws/common/shutdown_types.h>

AWS_PUSH_SANE_WARNING_LEVEL

typedef void(aws_simple_completion_callback)(void *);

/*
* A utility type for making ref-counted types, reminiscent of std::shared_ptr in C++
*/
Expand All @@ -22,11 +21,6 @@ struct aws_ref_count {
aws_simple_completion_callback *on_zero_fn;
};

struct aws_shutdown_callback_options {
aws_simple_completion_callback *shutdown_callback_fn;
void *shutdown_callback_user_data;
};

AWS_EXTERN_C_BEGIN

/**
Expand Down
34 changes: 34 additions & 0 deletions include/aws/common/shutdown_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef AWS_COMMON_SHUTDOWN_TYPES_H
#define AWS_COMMON_SHUTDOWN_TYPES_H

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#include <aws/common/common.h>

AWS_PUSH_SANE_WARNING_LEVEL

typedef void(aws_simple_completion_callback)(void *);

/**
* Configuration for a callback to invoke when something has been completely
* cleaned up. Primarily used in async cleanup control flows.
*/
struct aws_shutdown_callback_options {

/**
* Function to invoke when the associated object is fully destroyed.
*/
aws_simple_completion_callback *shutdown_callback_fn;

/**
* User data to invoke the shutdown callback with.
*/
void *shutdown_callback_user_data;
};

AWS_POP_SANE_WARNING_LEVEL

#endif /* AWS_COMMON_SHUTDOWN_TYPES_H */
Loading