2024-05-02 15:08:24 +00:00
|
|
|
/*
|
2024-10-29 07:36:43 +00:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2024-05-02 15:08:24 +00:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RCTBlockGuard is designed to be used with obj-c blocks to assist with manual deallocation of C++ resources
|
|
|
|
* tied to lifetime of a block. If C++ resources needs to be manually released at the end of block or when the block
|
|
|
|
* is deallocated, place the clean up code inside constructor and make sure the instace of the class is references in
|
|
|
|
* the block.
|
|
|
|
*/
|
|
|
|
@interface RCTBlockGuard : NSObject
|
|
|
|
|
|
|
|
- (instancetype)initWithCleanup:(void (^)(void))cleanup;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|