static struct dispatch *dispatch_get (flux_t h) { struct dispatch *d = flux_aux_get (h, "flux::dispatch"); if (!d) { flux_reactor_t *r = flux_get_reactor (h); if (!(d = malloc (sizeof (*d)))) goto nomem; memset (d, 0, sizeof (*d)); d->usecount = 1; if (!(d->handlers = zlist_new ())) goto nomem; if (!(d->handlers_new = zlist_new ())) goto nomem; d->h = h; d->w = flux_handle_watcher_create (r, h, FLUX_POLLIN, handle_cb, d); if (!d->w) goto nomem; fastpath_init (&d->norm); fastpath_init (&d->group); flux_aux_set (h, "flux::dispatch", d, dispatch_destroy); } return d; nomem: dispatch_destroy (d); errno = ENOMEM; return NULL; }
static struct dispatch *dispatch_get (flux_t h) { struct dispatch *d = flux_aux_get (h, "flux::dispatch"); if (!d) { flux_reactor_t *r = flux_get_reactor (h); d = xzmalloc (sizeof (*d)); d->handlers = zlist_new (); d->waiters = zlist_new (); if (!d->handlers || !d->waiters) oom (); d->h = h; d->w = flux_handle_watcher_create (r, h, FLUX_POLLIN, handle_cb, d); if (!d->w) oom (); d->usecount = 1; flux_aux_set (h, "flux::dispatch", d, dispatch_destroy); } return d; }