SCDNotifierCancel.c [plain text]
#include "SCDynamicStoreInternal.h"
#include "config.h"
Boolean
SCDynamicStoreNotifyCancel(SCDynamicStoreRef store)
{
#ifdef VERBOSE_ACTIVITY_LOGGING
struct os_activity_scope_state_s activity_state;
#endif // VERBOSE_ACTIVITY_LOGGING
SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store;
kern_return_t status;
int sc_status;
if (store == NULL) {
_SCErrorSet(kSCStatusNoStoreSession);
return FALSE;
}
switch (storePrivate->notifyStatus) {
case NotifierNotRegistered :
return TRUE;
case Using_NotifierInformViaRunLoop :
if (storePrivate->rls != NULL) {
CFRunLoopSourceRef rls;
rls = storePrivate->rls;
storePrivate->rls = NULL;
CFRunLoopSourceInvalidate(rls);
CFRelease(rls);
}
return TRUE;
case Using_NotifierInformViaDispatch :
(void) SCDynamicStoreSetDispatchQueue(store, NULL);
return TRUE;
default :
break;
}
if (storePrivate->server == MACH_PORT_NULL) {
sc_status = kSCStatusNoStoreServer;
goto done;
}
#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope_enter(storePrivate->activity, &activity_state);
#endif // VERBOSE_ACTIVITY_LOGGING
status = notifycancel(storePrivate->server, (int *)&sc_status);
if (__SCDynamicStoreCheckRetryAndHandleError(store,
status,
&sc_status,
"SCDynamicStoreNotifyCancel notifycancel()")) {
sc_status = kSCStatusOK;
}
#ifdef VERBOSE_ACTIVITY_LOGGING
os_activity_scope_leave(&activity_state);
#endif // VERBOSE_ACTIVITY_LOGGING
done :
if (sc_status != kSCStatusOK) {
_SCErrorSet(sc_status);
return FALSE;
}
return TRUE;
}