pid_t pid;
};
+static void kqop_free(struct kqop *kqop);
+
static void *kq_init (struct event_base *);
static int kq_add (struct event_base *, int, short, short, void *);
static int kq_del (struct event_base *, int, short, short, void *);
return (kqueueop);
err:
- if (kqueueop->changes)
- mm_free(kqueueop->changes);
- if (kqueueop->pend_changes)
- mm_free(kqueueop->pend_changes);
- if (kq >= 0)
- close(kq);
- mm_free(kqueueop);
+ if (kqueueop)
+ kqop_free(kqueueop);
+
return (NULL);
}
}
static void
-kq_dealloc(struct event_base *base)
+kqop_free(struct kqop *kqop)
{
- struct kqop *kqop = base->evbase;
-
if (kqop->changes)
mm_free(kqop->changes);
+ if (kqop->pend_changes)
+ mm_free(kqop->pend_changes);
if (kqop->events)
mm_free(kqop->events);
if (kqop->kq >= 0 && kqop->pid == getpid())
mm_free(kqop);
}
+static void
+kq_dealloc(struct event_base *base)
+{
+ struct kqop *kqop = base->evbase;
+ kqop_free(kqop);
+}
+
/* signal handling */
static int
kq_sig_add(struct event_base *base, int nsignal, short old, short events, void *p)