Exemplo n.º 1
0
void rwmsg_destination_destroy(rwmsg_destination_t *dt) {
    RW_ASSERT_TYPE(dt, rwmsg_destination_t);
    if (!dt->refct) {
        rwmsg_endpoint_t *ep = dt->ep;
        RW_ASSERT(ep);

        //?? TBD rwmsg_endpoint_del_srvchan_method_binding(ep, sc, ...);

        RWMSG_EP_LOCK(ep);
        RW_DL_REMOVE(&ep->track.destinations, dt, trackelem);
        RWMSG_EP_UNLOCK(ep);
        ck_pr_dec_32(&ep->stat.objects.destinations);

        if (dt->localep) {
            rwmsg_endpoint_release(dt->localep);
            dt->localep = NULL;
        }

        if (dt->defstream.localsc) {
            _RWMSG_CH_DEBUG_(&dt->defstream.localsc->ch, "--");
            rwmsg_srvchan_release(dt->defstream.localsc);
            dt->defstream.localsc = NULL;
        }

        RW_FREE_TYPE(dt, rwmsg_destination_t);
        dt = NULL;
    }
    return;
}
Exemplo n.º 2
0
void rwmsg_broker_main(uint32_t sid,
		       uint32_t instid,
		       uint32_t bro_instid,
		       rwsched_instance_ptr_t rws,
		       rwsched_tasklet_ptr_t tinfo,
		       rwcal_module_ptr_t rwcal,
		       uint32_t usemainq,
           rwtasklet_info_t *rwtasklet_info,
		       rwmsg_broker_t **bro_out) {
  
  rwmsg_broker_t *bro;
  rwmsg_endpoint_t *ep;

  ep = rwmsg_endpoint_create(sid, instid, bro_instid, rws, tinfo, rwtrace_init(), NULL);

  bro = rwmsg_broker_create(sid, bro_instid, NULL, rws, tinfo, rwcal, usemainq, ep, rwtasklet_info);
  if (bro_out) {
    *bro_out = bro;
  }

  /* Decrement by one, such that broker_halt will release the endpoint */
  RW_ASSERT(ep->refct >= 2);
  rwmsg_endpoint_release(ep);

  return;
}