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


C++ set_timeout函数代码示例

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


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

示例1: handle_request

static void
handle_request(int iscsi_fd, const struct iscsi_daemon_request *request, int timeout)
{
	struct connection *conn;

	log_set_peer_addr(request->idr_conf.isc_target_addr);
	if (request->idr_conf.isc_target[0] != '\0') {
		log_set_peer_name(request->idr_conf.isc_target);
		setproctitle("%s (%s)", request->idr_conf.isc_target_addr, request->idr_conf.isc_target);
	} else {
		setproctitle("%s", request->idr_conf.isc_target_addr);
	}

	conn = connection_new(request->idr_session_id, &request->idr_conf, iscsi_fd);
	set_timeout(timeout);
	capsicate(conn);
	login(conn);
	if (conn->conn_conf.isc_discovery != 0)
		discovery(conn);
	else
		handoff(conn);

	log_debugx("nothing more to do; exiting");
	exit (0);
}
开发者ID:ChristosKa,项目名称:freebsd,代码行数:25,代码来源:iscsid.c

示例2: set_incantation

int	set_incantation(t_stck *s, int fd, int pause, int (*funct)())
{
  int	i;
  int	*players;
  int	flag;
  int	ressource;

  i = 0;
  flag = 1;
  players = get_players_from_case(s, fd);
  ressource = check_ressource_for_incant(s, fd);
  while (players[i])
    {
      flag = s->fds[players[i]].level == s->fds[fd].level ? 1 : 0;
      i++;
    }
  if (flag && (i + 1) == gl_inc_tok[s->fds[fd].level - 1].nb_players
      && ressource)
    {
      set_timeout(s, fd, pause, funct);
      send_one("elevation en cours", fd, s);
      event_incant(s, fd, players);
    }
  else
    send_one("ko", fd, s);
  free(players);
  return (0);
}
开发者ID:Etienne-Breda,项目名称:school,代码行数:28,代码来源:check_action_ia.c

示例3: reqread_start

static inline void reqread_start(h2o_http1_conn_t *conn)
{
    set_timeout(conn, &conn->super.ctx->req_timeout, reqread_on_timeout);
    h2o_socket_read_start(conn->sock, reqread_on_read);
    if (conn->sock->input->size != 0)
        handle_incoming_request(conn);
}
开发者ID:laysakura,项目名称:h2o,代码行数:7,代码来源:http1.c

示例4: test_init

void
test_init (int *argcp, char ***argvp)
{
  /* If our argv only contained the executable name, assume we were
   * run by Automake with LOG_COMPILER overridden by
   * VALGRIND_CHECK_RULES from AX_VALGRIND_CHECK, and automatically switch
   * on TAP output. This avoids needing glib-tap-test.sh. We still use
   * glib-tap-test.sh in the common case because it replaces \r\n line
   * endings with \n, which we need if running the tests under Wine. */
  static char tap[] = "--tap";
  static char *substitute_argv[] = { NULL, tap, NULL };

  g_return_if_fail (argcp != NULL);
  g_return_if_fail (*argcp > 0);
  g_return_if_fail (argvp != NULL);
  g_return_if_fail (argvp[0] != NULL);
  g_return_if_fail (argvp[0][0] != NULL);

  if (*argcp == 1)
    {
      substitute_argv[0] = (*argvp)[0];
      *argcp = 2;
      *argvp = substitute_argv;
    }

  g_test_init (argcp, argvp, NULL);

  g_test_bug_base ("https://bugs.freedesktop.org/show_bug.cgi?id=");
  set_timeout (1);
}
开发者ID:smcv,项目名称:dbus,代码行数:30,代码来源:test-utils-glib.c

示例5: ksymp_set_timeout

void ksymp_set_timeout(KSYMediaPlayer *mp, int size)
{
    assert(mp);
    pthread_mutex_lock(&mp->mutex);
    set_timeout(mp->ffplayer, size);
    pthread_mutex_unlock(&mp->mutex);
}
开发者ID:kaiqi2391220,项目名称:KSYMediaPlayer-iOS-SDK,代码行数:7,代码来源:ksyplayer.c

示例6: ssl_want_read

void ssl_want_read(struct connection *c)
{
	struct conn_info *b = c->newconn;

	set_timeout(c);

	if (c->no_tsl) c->ssl->options |= SSL_OP_NO_TLSv1;
	switch (SSL_get_error(c->ssl, SSL_connect(c->ssl))) {
		case SSL_ERROR_NONE:
			c->newconn = NULL;
			b->func(c);
			mem_free(b);
			break;
		case SSL_ERROR_WANT_READ:
			set_handlers(*b->sock, (void(*)(void *))ssl_want_read, NULL, (void(*)(void *))exception, c);
			break;
		case SSL_ERROR_WANT_WRITE:
			set_handlers(*b->sock, NULL, (void(*)(void *))ssl_want_read, (void(*)(void *))exception, c);
			break;
		default:
			c->no_tsl++;
			setcstate(c, S_SSL_ERROR);
			retry_connection(c);
			break;
	}
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:26,代码来源:connect.c

示例7: os_read_line

zchar os_read_line (int max, zchar *buf, int timeout, int width, int continued)
{
  char c;
  int x,y;
  int i=0;
  int t=timeout*100;
  uint32 s,ms,tm;
  set_timeout(timeout);
  timer_ms_gettime(&s,&ms);

  i=strlen(buf);
  do {
    c=os_read_key(-1,1);
    if(c>=32 && c <= 176) c99_printf("%c",c);
    switch(c) {
    case 0:
    case 13:
      break;
    case 8:
      if(i>0) {
        i--;
        buf[i]='\0';
        getxy(&x,&y);
        locate(x-1,y);
      }
      break;
    default:
      buf[i]=c;
      i++;
      break;
    }
  } while (c!=13&&c!=0);
  buf[i]='\0';
  return c;
}
开发者ID:c99koder,项目名称:FrotzDC,代码行数:35,代码来源:dc_input.c

示例8: send_file

static void send_file(char *filename, struct sockaddr_in *client,
        char *addr, int master_sd, uint16_t blksize)
{
    char client_name[INET_ADDRSTRLEN];
    int  file;
    int  sd;
    char *message;

    message = xmalloc(4);
    memset(message, '\0', 4);

    if ((file = open(filename, O_RDONLY)) == -1)
    {
        send_error(client, TFTP_ERR_UNKNOWN_FILE,
                (char *)"File not found.", master_sd);
        return;
    }
    if (inet_ntop(AF_INET, &client->sin_addr, client_name,
            sizeof (client_name)))
        printf("Uploading %s to %s:%hu\n", filename, client_name,
                ntohs(client->sin_port));
    sd = prepare_socket(addr, 0);
    set_timeout(sd, 1);
    process_send_packets(client, blksize, file, sd, message);
    printf("Done.\n\n");
    close(sd);
    free(message);
    close(file);
}
开发者ID:jelmr,项目名称:SysProg,代码行数:29,代码来源:mytftpd.c

示例9: h_fast_timer_set

void h_fast_timer_set() {
  
#ifdef PRODUCTION
  if (!nw_fast_timer.set)
    set_timeout(&nw_fast_timer, 1);
#endif
}
开发者ID:openmach,项目名称:openmach,代码行数:7,代码来源:nw_mk.c

示例10: thread_depress_priority

/*
 *	thread_depress_priority
 *
 *	Depress thread's priority to lowest possible for specified period.
 *	Intended for use when thread wants a lock but doesn't know which
 *	other thread is holding it.  As with thread_switch, fixed
 *	priority threads get exactly what they asked for.  Users access
 *	this by the SWITCH_OPTION_DEPRESS option to thread_switch.  A Time
 *      of zero will result in no timeout being scheduled.
 */
void
thread_depress_priority(
	thread_t 		thread,
	mach_msg_timeout_t 	depress_time)
{
    unsigned int ticks;
    spl_t	s;

    /* convert from milliseconds to ticks */
    ticks = convert_ipc_timeout_to_ticks(depress_time);

    s = splsched();
    thread_lock(thread);

    /*
     *	If thread is already depressed, override previous depression.
     */
    reset_timeout_check(&thread->depress_timer);

    /*
     *	Save current priority, then set priority and
     *	sched_pri to their lowest possible values.
     */
    thread->depress_priority = thread->priority;
    thread->priority = 31;
    thread->sched_pri = 31;
    if (ticks != 0)
	set_timeout(&thread->depress_timer, ticks);

    thread_unlock(thread);
    (void) splx(s);
}
开发者ID:sebastianscatularo,项目名称:gnumach,代码行数:42,代码来源:syscall_subr.c

示例11: app_control_dial

static int app_control_dial(struct stasis_app_control *control,
	struct ast_channel *chan, void *data)
{
	struct control_dial_args *args = data;
	int bridged;

	ast_channel_lock(chan);
	bridged = ast_channel_is_bridged(chan);
	ast_channel_unlock(chan);

	if (!bridged && add_to_dial_bridge(control, chan)) {
		return -1;
	}

	if (args->timeout && set_timeout(chan, args->timeout)) {
		return -1;
	}

	if (ast_call(chan, args->dialstring, 0)) {
		return -1;
	}

	ast_channel_publish_dial(NULL, chan, args->dialstring, NULL);

	return 0;
}
开发者ID:coreyfarrell,项目名称:asterisk,代码行数:26,代码来源:control.c

示例12: __declspec

void __declspec(dllexport) WINAPI _set_timeout(lprec *lp, long sectimeout)
 {
  if (lp != NULL) {
   freebuferror();
   set_timeout(lp, sectimeout);
  }
 }
开发者ID:ks6g10,项目名称:CA,代码行数:7,代码来源:windll.c

示例13: next_state

static void next_state(void)
{
    s_current_state++;
    if (s_current_state == s_state_count)
    {
        if (s_repetitions > 0)
        {
            s_repetitions--;
        }

        // we've reached the end of the sequence, repeat
        if (s_repetitions == 0)
        {
            // no more repetitions, stop
            bsp_buzzer_stop();
            return;
        }
            
        // go back to the first state
        s_current_state = 0;
    }
    
    const bsp_buzzer_state_t* state = &s_states[s_current_state];
    if (state->freq > 0)
    {
        enable_output(s_buzzer,state->freq);
    }
    else
    {
        disable_output(s_buzzer);
    }
    set_timeout(state->ms);        
}
开发者ID:ShankarWright,项目名称:TklabsVanet,代码行数:33,代码来源:buzzer.c

示例14: rx_live

/* Receive and process packets. For now, returning from
 * stream_rx_usb() means that UAP and clocks have been found, and that
 * hopping should be started. A more flexible framework would be
 * nice. */
void rx_live(ubertooth_t* ut, btbb_piconet* pn, int timeout)
{
	int r = btbb_init(max_ac_errors);
	if (r < 0)
		return;

	if (timeout)
		set_timeout(ut, timeout);

	if (ut->follow_pn)
		cmd_set_clock(ut->devh, 0);
	else {
		stream_rx_usb(ut, cb_br_rx, pn);
		/* Allow pending transfers to finish */
		sleep(1);
	}
	/* Used when follow_pn is preset OR set by stream_rx_usb above
	 * i.e. This cannot be rolled in to the above if...else
	 */
	if (ut->follow_pn) {
		ut->stop_ubertooth = 0;
		ut->usb_really_full = 0;
		// cmd_stop(ut->devh);
		cmd_set_bdaddr(ut->devh, btbb_piconet_get_bdaddr(ut->follow_pn));
		cmd_start_hopping(ut->devh, btbb_piconet_get_clk_offset(ut->follow_pn));
		stream_rx_usb(ut, cb_br_rx, ut->follow_pn);
	}
}
开发者ID:the0system,项目名称:ubertooth,代码行数:32,代码来源:ubertooth.c

示例15: modem_command

static BOOL modem_command (const char *cmd, const char *resp, int timeout)
{
  DWORD timer;
  int   len = cmd ? strlen (cmd) : strlen (resp);

  if (cmd)
     rc = pkt_send (cmd, len);  /**<\todo Bypass PKTDRVR ? */

  if (rc < len || !_eth_is_init)
     return (FALSE);

  timer = set_timeout (1000 * timeout);

  while (!chk_timeout(timer))
  {
    char *pkt = (char*) _eth_arrived (NULL NULL);

    if (!pkt)
       continue;

    outsn (pkt, len);                             /* print the modem echo */
    _eth_free (pkt, type);
    return (strncmp(pkt,resp,strlen(resp)) == 0); /* got modem response */
  }
  return (FALSE);
}
开发者ID:ya-mouse,项目名称:dos-utils,代码行数:26,代码来源:pcslip.c


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