Reviewed By: dulmarod Differential Revision: D8713250 fbshipit-source-id: 7e9761cmaster
parent
e667c32324
commit
d442937380
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* 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>
|
||||
|
||||
void allocAndReleaseInBlock() {
|
||||
void (^callback)(CFRunLoopObserverRef obs, CFRunLoopActivity activity) =
|
||||
^(CFRunLoopObserverRef obs, CFRunLoopActivity activity) {
|
||||
// We should check if the object is released properly, see
|
||||
// infer/models/objc/src/CoreFoundation.c
|
||||
CFRelease(obs);
|
||||
};
|
||||
|
||||
CFRunLoopObserverRef observer = CFRunLoopObserverCreateWithHandler(
|
||||
NULL, kCFRunLoopBeforeWaiting, NO, UINT_MAX, callback);
|
||||
CFRunLoopAddObserver(CFRunLoopGetMain(), observer, kCFRunLoopCommonModes);
|
||||
}
|
Loading…
Reference in new issue