bool have_response;
};
-void ctdb_cluster_mutex_set_handler(struct ctdb_cluster_mutex_handle *h,
- cluster_mutex_handler_t handler,
- void *private_data)
-{
- h->handler = handler;
- h->private_data = private_data;
-}
-
static void cluster_mutex_timeout(struct tevent_context *ev,
struct tevent_timer *te,
struct timeval t, void *private_data)
ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
struct ctdb_context *ctdb,
const char *argstring,
- int timeout)
+ int timeout,
+ cluster_mutex_handler_t handler,
+ void *private_data)
{
struct ctdb_cluster_mutex_handle *h;
char **args;
tevent_fd_set_auto_close(h->fde);
h->ctdb = ctdb;
- h->handler = NULL;
- h->private_data = NULL;
+ h->handler = handler;
+ h->private_data = private_data;
return h;
}
double latency,
void *private_data);
-void ctdb_cluster_mutex_set_handler(struct ctdb_cluster_mutex_handle *h,
- cluster_mutex_handler_t handler,
- void *private_data);
-
struct ctdb_cluster_mutex_handle *
ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
struct ctdb_context *ctdb,
const char *argstring,
- int timeout);
+ int timeout,
+ cluster_mutex_handler_t handler,
+ void *private_data);
#endif /* __CTDB_IPALLOC_H__ */
state->ctdb = ctdb;
state->c = NULL;
- h = ctdb_cluster_mutex(state, ctdb, ctdb->recovery_lock, 5);
+ h = ctdb_cluster_mutex(state, ctdb, ctdb->recovery_lock, 5,
+ set_recmode_handler, state);
if (h == NULL) {
talloc_free(state);
return -1;
}
state->c = talloc_steal(state, c);
-
- /* set_recmode_handler() frees state/h */
- ctdb_cluster_mutex_set_handler(h,
- set_recmode_handler,
- state);
*async_reply = true;
return 0;
.latency = 0,
};
- h = ctdb_cluster_mutex(rec, ctdb, ctdb->recovery_lock, 0);
+ h = ctdb_cluster_mutex(rec, ctdb, ctdb->recovery_lock, 0,
+ hold_reclock_handler, &s);
if (h == NULL) {
return false;
}
- ctdb_cluster_mutex_set_handler(h, hold_reclock_handler, &s);
-
while (!s.done) {
tevent_loop_once(ctdb->ev);
}