/* This function is called when a notification is received. */ void MyNotificationCenterCallBack(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { printf("Notification center handler called\n"); }
...
/* Create a notification center */ CFNotificationCenterRef center = CFNotificationCenterGetDarwinNotifyCenter();
/* Tell notifyd to alert us when this notification is received. */ if (center) { CFNotificationCenterAddObserver(center, NULL, MyNotificationCenterCallBack, CFSTR("org.apache.httpd.configFileChanged"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); ... }
// Post CFNotificationCenterPostNotification(center, CFSTR("Notification Name"), NULL, NULL, TRUE);