/** * @brief Pause a session * * @param session_gen The session to pause * @param user_data Unused * * @todo This function should probably take care of pausing eventual * libev events when the scheduler is replaced. * * @internal This function should only be called from g_slist_foreach */ static void rtp_session_pause(gpointer session_gen, ATTR_UNUSED gpointer user_data) { RTP_session *session = (RTP_session *)session_gen; /* We should assert its presence, we cannot pause a non-running * session! */ if (session->fill_pool) rtp_fill_pool_free(session); ev_periodic_stop(session->srv->loop, &session->transport.rtp_writer); }
/** * Closes a transport linked to a session * @param session the RTP session for which to close the transport */ static void rtp_transport_close(RTP_session * session) { port_pair pair; pair.RTP = get_local_port(session->transport.rtp_sock); pair.RTCP = get_local_port(session->transport.rtcp_sock); ev_periodic_stop(session->srv->loop, &session->transport.rtp_writer); ev_io_stop(session->srv->loop, &session->transport.rtcp_reader); switch (session->transport.rtp_sock->socktype) { case UDP: RTP_release_port_pair(session->srv, &pair); default: break; } Sock_close(session->transport.rtp_sock); Sock_close(session->transport.rtcp_sock); }
static void Scheduler_Stop(struct ev_loop *loop, ev_prepare *prepare, int revents) { Scheduler *self = prepare->data; ev_periodic_stop(loop, (ev_periodic *)((Watcher *)self)->watcher); ev_prepare_stop(loop, prepare); PyErr_Restore(self->err_type, self->err_value, self->err_traceback); if (self->err_fatal) { PYEV_LOOP_EXIT(loop); } else { Loop_WarnOrStop(ev_userdata(loop), self->scheduler); } self->err_fatal = 0; self->err_traceback = NULL; self->err_value = NULL; self->err_type = NULL; }
static void stop_scheduler_Scheduler(ev_loop *loop, ev_prepare *prepare, int revents) { PyGILState_STATE gstate = PyGILState_Ensure(); Scheduler *self = prepare->data; ev_periodic_stop(loop, &((PeriodicBase *)self)->periodic); ev_prepare_stop(loop, &self->prepare); PyErr_Restore(self->err_type, self->err_value, self->err_traceback); if (self->err_fatal) { PYEV_EXIT_LOOP(loop); } else { set_error_Loop(ev_userdata(loop), self->scheduler); } self->err_fatal = 0; self->err_traceback = NULL; self->err_value = NULL; self->err_type = NULL; PyGILState_Release(gstate); }
static void periodic_watcher_cb(struct ev_loop *el, struct ev_periodic *ep, int revents) { static float conns_per_tick = 0.0f; static float conns_remainder = 0.0f; if (conns_per_tick == 0) { conns_per_tick = (connRate <= MAX_TICK_FREQUENCY) ? 1.0f : (connRate / MAX_TICK_FREQUENCY); DBG(0, ("making %f connections per tick\n", conns_per_tick)); } for (conns_remainder += conns_per_tick; conns_remainder >= 1.0f && numConns > conns_cnt; conns_remainder--, conns_cnt++) { spawn_connection(el); } if (numConns <= conns_cnt) { ev_periodic_stop(el, ep); } }
void rpl_free_instance(rpl_instance_t *instance) { rpl_dag_t *dag; rpl_dag_t *end; PRINTF("RPL: Leaving the instance %u\n", instance->instance_id); /* Remove any DODAG inside this instance */ for(dag = &instance->dag_table[0], end = dag + RPL_MAX_DODAG_PER_INSTANCE; dag < end; ++dag) { if(dag->used) { rpl_free_dodag(dag); } } ev_periodic_stop(event_loop,&instance->dio_timer.periodic); if(default_instance == instance) { default_instance = NULL; } instance->used = 0; }
static void periodic_stop (void *impl, flux_watcher_t *w) { struct f_periodic *fp = w->impl; assert (w->signature == PERIODIC_SIG); ev_periodic_stop (w->r->loop, &fp->evp); }