Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | /* * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _OSMEMORYNOTIFICATION_H_ #define _OSMEMORYNOTIFICATION_H_ #include <sys/cdefs.h> #include <Availability.h> /* ** OSMemoryNotification.h ** ** Kernel-generated notification mechanism to alert registered tasks when physical memory ** pressure reaches certain thresholds. Notifications are triggered in both directions ** so clients can manage their memory usage more and less aggressively. ** ** All of these functions and data types are iOS-only and deprecated in iOS 5.0. Applications ** should listen to UIKit memory warnings (didReceiveMemoryWarning or ** UIApplicationDidReceiveMemoryWarningNotification) instead. */ __BEGIN_DECLS struct timeval; /* ** Opaque type for notification object ** ** DEPRECATED. Use UIKit memory notification system. */ typedef struct _OSMemoryNotification * OSMemoryNotificationRef; /* ** Threshold values for notifications ** ** DEPRECATED. Use UIKit memory notification system. */ typedef enum { OSMemoryNotificationLevelAny = -1, OSMemoryNotificationLevelNormal = 0, OSMemoryNotificationLevelWarning = 1, OSMemoryNotificationLevelUrgent = 2, OSMemoryNotificationLevelCritical = 3 } OSMemoryNotificationLevel; /* ** Creation routines. Returns the created OSMemoryNotificationRef in the note param. ** returns: 0 on success ** ENOMEM if insufficient memory or resources exists to create the notification object ** EINVAL if the threshold is not a valid notification level ** ** DEPRECATED. Use UIKit memory notification system. */ int OSMemoryNotificationCreate(OSMemoryNotificationRef *note) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); /* ** returns: 0 on success ** EINVAL if the notification is not an initialized notification object ** ** DEPRECATED. Use UIKit memory notification system. */ int OSMemoryNotificationDestroy(OSMemoryNotificationRef note) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); /* ** Block waiting for notification ** returns: 0 on success, with the level that triggered the notification in the level param ** EINVAL if the notification object is invalid ** ETIMEDOUT if abstime passes before notification occurs ** ** 'note' is now ignored. ** ** DEPRECATED. Use UIKit memory notification system. */ int OSMemoryNotificationWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); int OSMemoryNotificationTimedWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level, const struct timeval *abstime) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); /* ** Simple polling interface to detect current memory pressure level ** ** DEPRECATED. This is not a reliable way to discover the system's memory condition and ** the level is not meaningful in iOS 5.0 and later. Use UIKit memory notification ** system instead, with no need to check the level. */ OSMemoryNotificationLevel OSMemoryNotificationCurrentLevel(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); /* ** External notify(3) string for manual notification setup ** ** DEPRECATED. Use UIKit memory notification system. */ extern const char *kOSMemoryNotificationName __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0); __END_DECLS #endif /* _OSMEMORYNOTIFICATION_H_ */ |