当前位置: 首页>>代码示例>>C++>>正文


C++ THREAD_ARG函数代码示例

本文整理汇总了C++中THREAD_ARG函数的典型用法代码示例。如果您正苦于以下问题:C++ THREAD_ARG函数的具体用法?C++ THREAD_ARG怎么用?C++ THREAD_ARG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了THREAD_ARG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bgp_keepalive_timer

/* BGP keepalive fire ! */
static int
bgp_keepalive_timer (struct thread *thread)
{
  struct peer *peer;

  peer = THREAD_ARG (thread);
  peer->t_keepalive = NULL;

  if (BGP_DEBUG (fsm, FSM))
    zlog (peer->log, LOG_DEBUG,
	  "%s [FSM] Timer (keepalive timer expire)",
	  peer->host);

  THREAD_VAL (thread) = KeepAlive_timer_expired;
  bgp_event (thread); /* bgp_event unlocks peer */

  return 0;
}
开发者ID:gvsurenderreddy,项目名称:quagga,代码行数:19,代码来源:bgp_fsm.c

示例2: ospf_hello_timer

int ospf_hello_timer(struct thread *thread)
{
	struct ospf_interface *oi;

	oi = THREAD_ARG(thread);
	oi->t_hello = NULL;

	if (IS_DEBUG_OSPF(ism, ISM_TIMERS))
		zlog(NULL, LOG_DEBUG, "ISM[%s]: Timer (Hello timer expire)",
		     IF_NAME(oi));

	/* Sending hello packet. */
	ospf_hello_send(oi);

	/* Hello timer set. */
	OSPF_HELLO_TIMER_ON(oi);

	return 0;
}
开发者ID:yubo,项目名称:quagga,代码行数:19,代码来源:ospf_ism.c

示例3: isis_adj_expire

int
isis_adj_expire (struct thread *thread)
{
  struct isis_adjacency *adj;
  int level;

  /*
   * Get the adjacency
   */
  adj = THREAD_ARG (thread);
  assert (adj);
  level = adj->level;
  adj->t_expire = NULL;

  /* trigger the adj expire event */
  isis_adj_state_change (adj, ISIS_ADJ_DOWN, "holding time expired");

  return 0;
}
开发者ID:OPSF,项目名称:uClinux,代码行数:19,代码来源:isis_adjacency.c

示例4: ospf6_bfd_down

int
ospf6_bfd_down (struct thread *thread)
{
  struct ospf6_neighbor *on;

  on = (struct ospf6_neighbor *) THREAD_ARG (thread);
  assert (on);

  if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
    zlog_info ("Neighbor Event %s: *BFD Down*", on->name);

  on->drouter = on->prev_drouter = 0;
  on->bdrouter = on->prev_bdrouter = 0;

  ospf6_neighbor_state_change (OSPF6_NEIGHBOR_DOWN, on);
  thread_add_event (master, neighbor_change, on->ospf6_if, 0);

  return 0;
}
开发者ID:thehajime,项目名称:zebra-manemo,代码行数:19,代码来源:ospf6_neighbor.c

示例5: hello_received

int hello_received(struct thread * thread)
{
  struct ospf6_neighbor * on;

  on = THREAD_ARG(thread);
  assert(on);

  printf("Hello Received\n");

  /* reset Inactivity Timer */
  THREAD_OFF (on->inactivity_timer);
  on->inactivity_timer = thread_add_timer (master, inactivity_timer, on,
                                           on->ospf6_if->dead_interval);
 
  if(on->state <= OSPF6_NEIGHBOR_DOWN)
      ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT, on);

  return 0;
}      
开发者ID:ecks,项目名称:harry,代码行数:19,代码来源:ospf6_neighbor.c

示例6: bgp_event

/* Execute event process. */
int
bgp_event (struct thread *thread)
{
  int ret = 0;
  int event;
  int next;
  struct peer *peer;

  peer = THREAD_ARG (thread);
  event = THREAD_VAL (thread);

  /* Logging this event. */
  next = FSM [peer->status -1][event - 1].next_state;

  if (BGP_DEBUG (fsm, FSM) && peer->status != next)
    plog_debug (peer->log, "%s [FSM] %s (%s->%s)", peer->host, 
	       bgp_event_str[event],
	       LOOKUP (bgp_status_msg, peer->status),
	       LOOKUP (bgp_status_msg, next));

  /* Call function. */
  if (FSM [peer->status -1][event - 1].func)
    ret = (*(FSM [peer->status - 1][event - 1].func))(peer);

  /* When function do not want proceed next job return -1. */
  if (ret >= 0)
    {
      /* If status is changed. */
      if (next != peer->status)
        {
          /* Transition into Clearing must /always/ clear all routes.. */
          if (next == Clearing)
            bgp_clear_route_all (peer);
          
          bgp_fsm_change_status (peer, next);
        }
      
      /* Make sure timer is set. */
      bgp_timer_set (peer);
    }
  
  return ret;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:44,代码来源:bgp_fsm.c

示例7: neighbor_change

int
neighbor_change (struct thread *thread)
{
  struct ospf6_interface *oi;

  oi = (struct ospf6_interface *) THREAD_ARG (thread);
  assert (oi && oi->interface);

  if (IS_OSPF6_DEBUG_INTERFACE)
    zlog_debug ("Interface Event %s: [NeighborChange]",
		oi->interface->name);

  if (oi->state == OSPF6_INTERFACE_DROTHER ||
      oi->state == OSPF6_INTERFACE_BDR ||
      oi->state == OSPF6_INTERFACE_DR)
    ospf6_interface_state_change (dr_election (oi), oi);

  return 0;
}
开发者ID:rgmabs19357,项目名称:qpimd,代码行数:19,代码来源:ospf6_interface.c

示例8: bgp_start_timer

/* BGP start timer.  This function set BGP_Start event to thread value
   and process event. */
static int
bgp_start_timer (struct thread *thread)
{
  struct peer *peer;

  peer = THREAD_ARG (thread);
  peer->t_start = NULL;

  UNSET_FLAG (peer->sflags, PEER_STATUS_CREATE_INIT);

  if (BGP_DEBUG (fsm, FSM))
    zlog (peer->log, LOG_DEBUG,
	  "%s [FSM] Timer (start timer expire).", peer->host);

  THREAD_VAL (thread) = BGP_Start;
  bgp_event (thread);

  return 0;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:21,代码来源:bgp_fsm.c

示例9: hello_low_send

//周期性发送hello low数据包
int hello_low_send(struct thread * thread)
{
	struct backbone_eth* eth = (struct backbone_eth *)THREAD_ARG(thread);
	struct hello_low* hello_low = (struct hello_low*)sendbuf;
	struct hello_master* hello_master = eth->hello_master;
	
	hello_master->hello_timer_low = thread_add_timer_high_resolution(master, hello_low_send, eth, TMP_VAR * hello_master->l_hello_val);

	memset(sendbuf, 0, MAX_MESSAGE_LEN);

	hello_low->lsd_head.pktype = IC_MESSAGE_TYPE_HELLO_L;
	hello_low->lsd_head.pklen = sizeof(struct hello_low);

	hello_low->dead_interval = TMP_VAR * hello_master->l_dead_val;
	hello_low->hello_interval = TMP_VAR * hello_master->l_hello_val;

	lsd_send(eth, (struct lsd_head *)sendbuf);
	return 0;
}
开发者ID:exeasy,项目名称:pma2,代码行数:20,代码来源:lsd_hello.c

示例10: tcp_socket_state

enum connect_result
tcp_socket_state(int fd, thread_t * thread, int (*func) (thread_t *))
{
	int status;
	socklen_t addrlen;
	int ret = 0;
	timeval_t timer_min;

	/* Handle connection timeout */
	if (thread->type == THREAD_WRITE_TIMEOUT) {
		close(thread->u.fd);
		return connect_timeout;
	}

	/* Check file descriptor */
	addrlen = sizeof(status);
	if (getsockopt(thread->u.fd, SOL_SOCKET, SO_ERROR, (void *) &status, &addrlen) < 0)
		ret = errno;

	/* Connection failed !!! */
	if (ret) {
		close(thread->u.fd);
		return connect_error;
	}

	/* If status = 0, TCP connection to remote host is established.
	 * Otherwise register checker thread to handle connection in progress,
	 * and other error code until connection is established.
	 * Recompute the write timeout (or pending connection).
	 */
	if (status == EINPROGRESS) {
		timer_min = timer_sub_now(thread->sands);
		thread_add_write(thread->master, func, THREAD_ARG(thread),
				 thread->u.fd, timer_long(timer_min));
		return connect_in_progress;
	} else if (status != 0) {
		close(thread->u.fd);
		return connect_error;
	}

	return connect_success;
}
开发者ID:Am1GO,项目名称:keepalived,代码行数:42,代码来源:layer4.c

示例11: bgp_event

/* Execute event process. */
int
bgp_event (struct thread *thread)
{
  int ret;
  int event;
  int next;
  struct peer *peer;

  peer = THREAD_ARG (thread);
  event = THREAD_VAL (thread);

  /* Logging this event. */
  next = FSM [peer->status -1][event - 1].next_state;

  if (BGP_DEBUG (fsm, FSM))
    plog_info (peer->log, "%s [FSM] %s (%s->%s)", peer->host, 
	       bgp_event_str[event],
	       LOOKUP (bgp_status_msg, peer->status),
	       LOOKUP (bgp_status_msg, next));
  if (BGP_DEBUG (normal, NORMAL)
      && strcmp (LOOKUP (bgp_status_msg, peer->status), LOOKUP (bgp_status_msg, next)))
    zlog_info ("%s went from %s to %s",
	       peer->host,
	       LOOKUP (bgp_status_msg, peer->status),
	       LOOKUP (bgp_status_msg, next));

  /* Call function. */
  ret = (*(FSM [peer->status - 1][event - 1].func))(peer);

  /* When function do not want proceed next job return -1. */
  if (ret < 0)
    return ret;
    
  /* If status is changed. */
  if (next != peer->status)
    bgp_fsm_change_status (peer, next);

  /* Make sure timer is set. */
  bgp_timer_set (peer);

  return 0;
}
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:43,代码来源:bgp_fsm.c

示例12: http_read_thread

/* Asynchronous HTTP stream reader */
int
http_read_thread(thread_t * thread)
{
	SOCK *sock_obj = THREAD_ARG(thread);
	int r = 0;

	/* Handle read timeout */
	if (thread->type == THREAD_READ_TIMEOUT)
		return epilog(thread);

	/* read the HTTP stream */
	memset(sock_obj->buffer, 0, MAX_BUFFER_LENGTH);
	r = read(thread->u.fd, sock_obj->buffer + sock_obj->size,
		 MAX_BUFFER_LENGTH - sock_obj->size);

	DBG(" [l:%d,fd:%d]\n", r, sock_obj->fd);

	if (r == -1 || r == 0) {	/* -1:error , 0:EOF */
		if (r == -1) {
			/* We have encourred a real read error */
			DBG("Read error with server [%s]:%d: %s\n",
			    inet_ntop2(req->addr_ip), ntohs(req->addr_port),
			    strerror(errno));
			return epilog(thread);
		}

		/* All the HTTP stream has been parsed */
		finalize(thread);
	} else {
		/* Handle the response stream */
		http_process_stream(sock_obj, r);

		/*
		 * Register next http stream reader.
		 * Register itself to not perturbe global I/O multiplexer.
		 */
		thread_add_read(thread->master, http_read_thread, sock_obj,
				thread->u.fd, HTTP_CNX_TIMEOUT);
	}

	return 0;
}
开发者ID:dencorpos,项目名称:keepalived,代码行数:43,代码来源:http.c

示例13: rcpt_cmd

/* RCPT command processing */
static int
rcpt_cmd(thread_t * thread)
{
	smtp_t *smtp = THREAD_ARG(thread);
	char *buffer;
	char *fetched_email;

	buffer = (char *) MALLOC(SMTP_BUFFER_MAX);
	/* We send RCPT TO command multiple time to add all our email receivers.
	 * --rfc821.3.1
	 */
	fetched_email = fetch_next_email(smtp);

	snprintf(buffer, SMTP_BUFFER_MAX, SMTP_RCPT_CMD, fetched_email);
	if (send(thread->u.fd, buffer, strlen(buffer), 0) == -1)
		smtp->stage = ERROR;
	FREE(buffer);

	return 0;
}
开发者ID:MaheshWaidande,项目名称:keepalived,代码行数:21,代码来源:smtp.c

示例14: lsa_delete

static int
lsa_delete (struct thread *t)
{
  struct ospf_apiclient *oclient;
  struct in_addr area_id;
  int rc;

  oclient = THREAD_ARG (t);

  inet_aton (args[6], &area_id);

  printf ("Deleting LSA... ");
  rc = ospf_apiclient_lsa_delete (oclient, 
				  area_id, 
				  atoi (args[2]),       /* lsa type */
				  atoi (args[3]),	/* opaque type */
				  atoi (args[4]));	/* opaque ID */
  printf ("done, return code is = %d\n", rc);
  return rc;
}
开发者ID:Addision,项目名称:LVS,代码行数:20,代码来源:ospfclient.c

示例15: loading_done

int
loading_done (struct thread *thread)
{
  struct ospf6_neighbor *on;

  on = (struct ospf6_neighbor *) THREAD_ARG (thread);
  assert (on);

  if (on->state != OSPF6_NEIGHBOR_LOADING)
    return 0;

  if (IS_OSPF6_SIBLING_DEBUG_NEIGHBOR)
    zlog_debug ("Neighbor Event %s: *LoadingDone*", on->name);

  assert (on->request_list->count == 0); 

  ospf6_neighbor_state_change (OSPF6_NEIGHBOR_FULL, on);

  return 0;
}
开发者ID:ecks,项目名称:harry,代码行数:20,代码来源:ospf6_neighbor.c


注:本文中的THREAD_ARG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。