#define _OSMEMORYNOTIFICATION_H_
#include <sys/cdefs.h>
+#include <Availability.h>
/*
** OSMemoryNotification.h
** 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
/*
** 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 {
** 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);
+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);
+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);
-int OSMemoryNotificationTimedWait(OSMemoryNotificationRef note, OSMemoryNotificationLevel *level, const struct timeval *abstime);
+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);
+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;
+extern const char *kOSMemoryNotificationName __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0);
__END_DECLS