本文整理汇总了C++中THREAD_OFF函数的典型用法代码示例。如果您正苦于以下问题:C++ THREAD_OFF函数的具体用法?C++ THREAD_OFF怎么用?C++ THREAD_OFF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了THREAD_OFF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eigrp_nbr_state_update
void
eigrp_nbr_state_update (struct eigrp_neighbor *nbr)
{
switch (nbr->state)
{
case EIGRP_NEIGHBOR_DOWN:
{
/*Start Hold Down Timer for neighbor*/
// THREAD_OFF(nbr->t_holddown);
// THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired,
// nbr, nbr->v_holddown);
break;
}
case EIGRP_NEIGHBOR_PENDING:
{
/*Reset Hold Down Timer for neighbor*/
THREAD_OFF(nbr->t_holddown);
THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
nbr->v_holddown);
break;
}
case EIGRP_NEIGHBOR_UP:
{
/*Reset Hold Down Timer for neighbor*/
THREAD_OFF(nbr->t_holddown);
THREAD_TIMER_ON(master, nbr->t_holddown, holddown_timer_expired, nbr,
nbr->v_holddown);
break;
}
}
}
示例2: oneway_received
int
oneway_received (struct thread *thread)
{
struct ospf6_neighbor *on;
struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *) THREAD_ARG (thread);
assert (on);
if (on->state < OSPF6_NEIGHBOR_TWOWAY)
return 0;
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
zlog_info ("Neighbor Event %s: *1Way-Received*", on->name);
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_INIT, on);
thread_add_event (master, neighbor_change, on->ospf6_if, 0);
ospf6_lsdb_remove_all (on->summary_list);
ospf6_lsdb_remove_all (on->request_list);
for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
lsa = ospf6_lsdb_next (lsa))
{
ospf6_decrement_retrans_count (lsa);
ospf6_lsdb_remove (lsa, on->retrans_list);
}
THREAD_OFF (on->thread_send_dbdesc);
THREAD_OFF (on->thread_send_lsreq);
THREAD_OFF (on->thread_send_lsupdate);
THREAD_OFF (on->thread_send_lsack);
return 0;
}
示例3: ospf6_area_delete
void
ospf6_area_delete (struct ospf6_area *oa)
{
struct listnode *n, *nnode;
struct ospf6_interface *oi;
ospf6_route_table_delete (oa->range_table);
ospf6_route_table_delete (oa->summary_prefix);
ospf6_route_table_delete (oa->summary_router);
/* ospf6 interface list */
for (ALL_LIST_ELEMENTS (oa->if_list, n, nnode, oi))
{
ospf6_interface_delete (oi);
}
list_delete (oa->if_list);
ospf6_lsdb_delete (oa->lsdb);
ospf6_lsdb_delete (oa->lsdb_self);
ospf6_spf_table_finish (oa->spf_table);
ospf6_route_table_delete (oa->spf_table);
ospf6_route_table_delete (oa->route_table);
THREAD_OFF (oa->thread_spf_calculation);
THREAD_OFF (oa->thread_route_calculation);
listnode_delete (oa->ospf6->area_list, oa);
oa->ospf6 = NULL;
/* free area */
XFREE (MTYPE_OSPF6_AREA, oa);
}
示例4: zclient_stop
/* Stop zebra client services. */
void
zclient_stop (struct zclient *zclient)
{
if (zclient_debug)
zlog_debug ("zclient stopped");
/* Stop threads. */
THREAD_OFF(zclient->t_read);
THREAD_OFF(zclient->t_connect);
THREAD_OFF(zclient->t_write);
/* Reset streams. */
stream_reset(zclient->ibuf);
stream_reset(zclient->obuf);
/* Empty the write buffer. */
buffer_reset(zclient->wb);
/* Close socket. */
if (zclient->sock >= 0)
{
close (zclient->sock);
zclient->sock = -1;
}
zclient->fail = 0;
}
示例5: sock_close
static void sock_close(struct igmp_sock *igmp)
{
pim_igmp_other_querier_timer_off(igmp);
pim_igmp_general_query_off(igmp);
if (PIM_DEBUG_IGMP_TRACE) {
if (igmp->t_igmp_read) {
zlog_debug("Cancelling READ event on IGMP socket %s fd=%d on interface %s",
inet_ntoa(igmp->ifaddr), igmp->fd,
igmp->interface->name);
}
}
THREAD_OFF(igmp->t_igmp_read);
zassert(!igmp->t_igmp_read);
if (close(igmp->fd)) {
zlog_err("Failure closing IGMP socket %s fd=%d on interface %s: errno=%d: %s",
inet_ntoa(igmp->ifaddr), igmp->fd, igmp->interface->name,
errno, safe_strerror(errno));
}
if (PIM_DEBUG_IGMP_TRACE) {
zlog_debug("Deleted IGMP socket %s fd=%d on interface %s",
inet_ntoa(igmp->ifaddr), igmp->fd, igmp->interface->name);
}
}
示例6: igmp_group_delete
static void igmp_group_delete(struct igmp_group *group)
{
struct listnode *src_node;
struct listnode *src_nextnode;
struct igmp_source *src;
if (PIM_DEBUG_IGMP_TRACE) {
char group_str[100];
pim_inet4_dump("<group?>", group->group_addr, group_str, sizeof(group_str));
zlog_debug("Deleting IGMP group %s from socket %d interface %s",
group_str,
group->group_igmp_sock->fd,
group->group_igmp_sock->interface->name);
}
for (ALL_LIST_ELEMENTS(group->group_source_list, src_node, src_nextnode, src)) {
igmp_source_delete(src);
}
if (group->t_group_query_retransmit_timer) {
THREAD_OFF(group->t_group_query_retransmit_timer);
zassert(!group->t_group_query_retransmit_timer);
}
group_timer_off(group);
listnode_delete(group->group_igmp_sock->igmp_group_list, group);
igmp_group_free(group);
}
示例7: pim_vxlan_work_timer_setup
/* global 1second timer used for periodic processing */
static void pim_vxlan_work_timer_setup(bool start)
{
THREAD_OFF(vxlan_info.work_timer);
if (start)
thread_add_timer(router->master, pim_vxlan_work_timer_cb, NULL,
PIM_VXLAN_WORK_TIME, &vxlan_info.work_timer);
}
示例8: hello_on_high_packet_received
//receive and process hello high packet
void hello_on_high_packet_received(struct backbone_eth* eth, struct lsd_head *head)
{
struct hello_high *hello_high = (struct hello_high *)head;
struct hello_master* hello_master = eth->hello_master;
if (head->pktype != IC_MESSAGE_TYPE_HELLO_H)
return;
hello_high = (struct hello_high *)head;
THREAD_OFF(hello_master->dead_timer_high);
hello_master->dead_timer_high = thread_add_timer_high_resolution(master, dead_timer_high, eth, TMP_VAR * hello_master->h_dead_val);
if(hello_master->high_status == LSD_DISCONNETED)
{
hello_master->high_status = LSD_CONNECTED;
hello_master->neighbor.rt_id = hello_high->lsd_head.r_id;
hello_master->neighbor.if_id = hello_high->lsd_head.if_id;
printf("Link Connected---Neighbor[%d]:[%d]\n",hello_master->neighbor.rt_id,hello_master->neighbor.if_id);
char dst_addr[25],nexthop[25];
//if(eth->neighbour->ctrl_addr.s_addr!=0){
//inet_ntop(AF_INET,ð->neighbour->ctrl_addr,dst_addr,25);
//inet_ntop(AF_INET,ð->neighbour->nexthop_addr,nexthop,25);
//addStaticRoute(routerip, dst_addr,"255.255.255.255", nexthop);
//}
//eth->eth_state = ETH_UP;
struct event_handler_item* item;
for(item = detection_queue.next; item; item = item->next)
((hello_detection_handler)(item->handler))(eth, HIGH_PRIORITY_DETECTION, LSD_CONNECTED);
}
}
示例9: exchange_done
int exchange_done(struct thread * thread)
{
struct ospf6_neighbor *on;
on = (struct ospf6_neighbor *) THREAD_ARG (thread);
assert (on);
if (on->state != OSPF6_NEIGHBOR_EXCHANGE)
return 0;
if (IS_OSPF6_SIBLING_DEBUG_NEIGHBOR)
zlog_debug ("Neighbor Event %s: *ExchangeDone*", on->name);
THREAD_OFF (on->thread_send_dbdesc);
ospf6_lsdb_remove_all (on->dbdesc_list);
/* XXX
thread_add_timer (master, ospf6_neighbor_last_dbdesc_release, on,
on->ospf6_if->dead_interval);
*/
if (on->request_list->count == 0)
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on);
else
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_LOADING, on);
return 0;
}
示例10: bad_lsreq
int bad_lsreq(struct thread * thread)
{
struct ospf6_neighbor * on;
struct ospf6_lsa * lsa;
on = (struct ospf6_neighbor *) THREAD_ARG(thread);
assert(on);
if(on->state < OSPF6_NEIGHBOR_EXCHANGE)
return 0;
if(IS_OSPF6_SIBLING_DEBUG_NEIGHBOR)
zlog_debug("Neighbor Event %s: *BadLSReq*", on->name);
ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART, on);
SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT);
SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT);
ospf6_lsdb_remove_all(on->summary_list);
ospf6_lsdb_remove_all(on->request_list);
for(lsa = ospf6_lsdb_head(on->retrans_list); lsa;
lsa = ospf6_lsdb_next(lsa))
{
ospf6_decrement_retrans_count(lsa);
ospf6_lsdb_remove(lsa, on->retrans_list);
}
THREAD_OFF(on->thread_send_dbdesc);
on->thread_send_dbdesc =
thread_add_event(master, ospf6_dbdesc_send, on, 0);
return 0;
}
示例11: zebra_server_send_message
static int
zebra_server_send_message(struct zserv *client)
{
if (client->t_suicide)
return -1;
switch (buffer_write(client->wb, client->sock, STREAM_DATA(client->obuf),
stream_get_endp(client->obuf)))
{
case BUFFER_ERROR:
zlog_warn("%s: buffer_write failed to zserv client fd %d, closing",
__func__, client->sock);
/* Schedule a delayed close since many of the functions that call this
one do not check the return code. They do not allow for the
possibility that an I/O error may have caused the client to be
deleted. */
client->t_suicide = thread_add_event(zebrad.master, zserv_delayed_close,
client, 0);
return -1;
case BUFFER_EMPTY:
THREAD_OFF(client->t_write);
break;
case BUFFER_PENDING:
THREAD_WRITE_ON(zebrad.master, client->t_write,
zserv_flush_data, client, client->sock);
break;
}
return 0;
}
示例12: isis_circuit_down
void
isis_circuit_down (struct isis_circuit *circuit)
{
/* Cancel all active threads -- FIXME: wrong place */
/* HT: Read thread if GNU_LINUX, TIMER thread otherwise. */
THREAD_OFF (circuit->t_read);
if (circuit->circ_type == CIRCUIT_T_BROADCAST)
{
THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[0]);
THREAD_TIMER_OFF (circuit->u.bc.t_send_lan_hello[1]);
THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[0]);
THREAD_TIMER_OFF (circuit->u.bc.t_run_dr[1]);
}
else if (circuit->circ_type == CIRCUIT_T_P2P)
{
THREAD_TIMER_OFF (circuit->u.p2p.t_send_p2p_hello);
}
if (circuit->t_send_psnp[0]) {
THREAD_TIMER_OFF (circuit->t_send_psnp[0]);
}
if (circuit->t_send_psnp[1]) {
THREAD_TIMER_OFF (circuit->t_send_psnp[1]);
}
/* close the socket */
close (circuit->fd);
return;
}
示例13: twoway_received
int
twoway_received (struct thread *thread)
{
struct ospf6_neighbor *on;
on = (struct ospf6_neighbor *) THREAD_ARG (thread);
assert (on);
if (on->state > OSPF6_NEIGHBOR_INIT)
return 0;
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
zlog_info ("Neighbor Event %s: *2Way-Received*", on->name);
thread_add_event (master, neighbor_change, on->ospf6_if, 0);
if (! need_adjacency (on))
{
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on);
return 0;
}
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
THREAD_OFF (on->thread_send_dbdesc);
on->thread_send_dbdesc =
thread_add_event (master, ospf6_dbdesc_send, on, 0);
return 0;
}
示例14: pim_msdp_peer_ka_timer_setup
static void pim_msdp_peer_ka_timer_setup(struct pim_msdp_peer *mp, bool start)
{
THREAD_OFF(mp->ka_timer);
if (start) {
thread_add_timer(mp->pim->msdp.master,
pim_msdp_peer_ka_timer_cb, mp,
PIM_MSDP_PEER_KA_TIME, &mp->ka_timer);
}
}
示例15: pim_msdp_peer_hold_timer_setup
static void pim_msdp_peer_hold_timer_setup(struct pim_msdp_peer *mp, bool start)
{
struct pim_instance *pim = mp->pim;
THREAD_OFF(mp->hold_timer);
if (start) {
thread_add_timer(pim->msdp.master, pim_msdp_peer_hold_timer_cb,
mp, PIM_MSDP_PEER_HOLD_TIME, &mp->hold_timer);
}
}