/** * Sets a notification function to be called when the reply is * received or the pending call times out. * * @param pending the pending call * @param function notifier function * @param user_data data to pass to notifier function * @param free_user_data function to free the user data * @returns #FALSE if not enough memory */ dbus_bool_t dbus_pending_call_set_notify (DBusPendingCall *pending, DBusPendingCallNotifyFunction function, void *user_data, DBusFreeFunction free_user_data) { dbus_bool_t ret = FALSE; _dbus_return_val_if_fail (pending != NULL, FALSE); CONNECTION_LOCK (pending->connection); /* could invoke application code! */ if (!_dbus_pending_call_set_data_unlocked (pending, notify_user_data_slot, user_data, free_user_data)) goto out; pending->function = function; ret = TRUE; out: CONNECTION_UNLOCK (pending->connection); return ret; }
/** * Stores a pointer on a #DBusPendingCall, along * with an optional function to be used for freeing * the data when the data is set again, or when * the pending call is finalized. The slot number * must have been allocated with dbus_pending_call_allocate_data_slot(). * * @param pending the pending_call * @param slot the slot number * @param data the data to store * @param free_data_func finalizer function for the data * @returns #TRUE if there was enough memory to store the data */ dbus_bool_t dbus_pending_call_set_data (DBusPendingCall *pending, dbus_int32_t slot, void *data, DBusFreeFunction free_data_func) { dbus_bool_t retval; _dbus_return_val_if_fail (pending != NULL, FALSE); _dbus_return_val_if_fail (slot >= 0, FALSE); CONNECTION_LOCK (pending->connection); retval = _dbus_pending_call_set_data_unlocked (pending, slot, data, free_data_func); CONNECTION_UNLOCK (pending->connection); return retval; }