static void *__wind_shadow_eventcb(int event, void *data) { struct wind_resource_holder *rh; switch (event) { case XNSHADOW_CLIENT_ATTACH: rh = (struct wind_resource_holder *) xnarch_alloc_host_mem(sizeof(*rh)); if (!rh) return ERR_PTR(-ENOMEM); initq(&rh->wdq); /* A single server thread pends on this. */ xnsynch_init(&rh->wdsynch, XNSYNCH_FIFO, NULL); initq(&rh->wdpending); rh->wdcount = 0; initq(&rh->msgQq); initq(&rh->semq); return &rh->ppd; case XNSHADOW_CLIENT_DETACH: rh = ppd2rholder((xnshadow_ppd_t *) data); wind_wd_flush_rq(&rh->wdq); xnsynch_destroy(&rh->wdsynch); /* No need to reschedule: all our threads have been zapped. */ wind_msgq_flush_rq(&rh->msgQq); wind_sem_flush_rq(&rh->semq); xnarch_free_host_mem(rh, sizeof(*rh)); return NULL; } return ERR_PTR(-EINVAL); }
void wind_msgq_cleanup(void) { wind_msgq_flush_rq(&__wind_global_rholder.msgQq); }