• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_timeout函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ftp_login

static void ftp_login(struct connection *c)
{
    unsigned char *login;
    unsigned char *u;
    int logl = 0;
    set_timeout(c);
    login = init_str();
    add_to_str(&login, &logl, cast_uchar "USER ");
    if ((u = get_user_name(c->url)) && *u) add_to_str(&login, &logl, u);
    else add_to_str(&login, &logl, cast_uchar "anonymous");
    if (u) mem_free(u);
    if (ftp_options.fast_ftp) {
        struct ftp_connection_info *fi;
        add_to_str(&login, &logl, cast_uchar "\r\nPASS ");
        if ((u = get_pass(c->url)) && *u) add_to_str(&login, &logl, u);
        else add_to_str(&login, &logl, ftp_options.anon_pass);
        if (u) mem_free(u);
        add_to_str(&login, &logl, cast_uchar "\r\n");
        if (!(fi = add_file_cmd_to_str(c))) {
            mem_free(login);
            return;
        }
        add_to_str(&login, &logl, fi->cmdbuf);
    } else add_to_str(&login, &logl, cast_uchar "\r\n");
    write_to_socket(c, c->sock1, login, strlen(cast_const_char login), ftp_logged);
    mem_free(login);
    setcstate(c, S_SENT);
}
开发者ID:coolstreamtech,项目名称:cst-public-plugins-links,代码行数:28,代码来源:ftp.c


示例17: receive_file

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

    if (!(file = fopen(filename, "w")))
    {
        send_error(client, TFTP_ERR_ACCES_VIOLATION,
                (char *)"Unable to write to file.", master_sd);
        return;
    }
    if (inet_ntop(AF_INET, &client->sin_addr, client_name,
                sizeof (client_name)))
        printf("Downloading %s from %s:%hu\n", filename, client_name,
                ntohs(client->sin_port));
    sd = prepare_socket(addr, 0);
    set_timeout(sd, 1);
    if (blksize == TFTP_DEFAULT_BLKSZ)
        send_ack(sd, client, 0);
    else
        send_blksize_ack(sd, client, blksize);
    process_receive_packets(client, blksize, &current_client, file, sd);
    printf("Done.\n\n");
    close(sd);
    fclose(file);
}
开发者ID:jelmr,项目名称:SysProg,代码行数:29,代码来源:mytftpd.c


示例18: get_ftp_response

static int get_ftp_response(struct connection *c, struct read_buffer *rb, int part)
{
    int l;
    set_timeout(c);
again:
    for (l = 0; l < rb->len; l++) if (rb->data[l] == 10) {
            unsigned char *e;
            long k = strtoul(cast_const_char rb->data, (char **)(void *)&e, 10);
            if (e != rb->data + 3 || k < 100 || k >= 1000) return -1;
            if (*e == '-') {
                int i;
                for (i = 0; i < rb->len - 5; i++) {
                    if (rb->data[i] == 10 && !memcmp(rb->data+i+1, rb->data, 3) && rb->data[i+4] == ' ') {
                        for (i++; i < rb->len; i++) if (rb->data[i] == 10) goto ok;
                        return 0;
                    }
                }
                return 0;
ok:
                l = i;
            }
            if (!part && k >= 100 && k < 200) {
                kill_buffer_data(rb, l + 1);
                goto again;
            }
            if (part == 2) return k;
            kill_buffer_data(rb, l + 1);
            return k;
        }
    return 0;
}
开发者ID:coolstreamtech,项目名称:cst-public-plugins-links,代码行数:31,代码来源:ftp.c


示例19: settle_timeout

static void settle_timeout(struct timer_list *t)
{
	struct floppy_state *fs = from_timer(fs, t, timeout);
	struct swim3 __iomem *sw = fs->swim3;
	unsigned long flags;

	swim3_dbg("* settle timeout, state=%d\n", fs->state);

	spin_lock_irqsave(&swim3_lock, flags);
	fs->timeout_pending = 0;
	if (swim3_readbit(fs, SEEK_COMPLETE)) {
		out_8(&sw->select, RELAX);
		fs->state = locating;
		act(fs);
		goto unlock;
	}
	out_8(&sw->select, RELAX);
	if (fs->settle_time < 2*HZ) {
		++fs->settle_time;
		set_timeout(fs, 1, settle_timeout);
		goto unlock;
	}
	swim3_err("%s", "Seek settle timeout\n");
	swim3_end_request(fs, BLK_STS_IOERR, 0);
	fs->state = idle;
	start_request(fs);
 unlock:
	spin_unlock_irqrestore(&swim3_lock, flags);
}
开发者ID:JamesChenFromChina,项目名称:linux,代码行数:29,代码来源:swim3.c


示例20: serial_open

int serial_open(urg_serial_t *serial, const char *device, long baudrate)
{
    // COM10 以降への対応用
    enum { NameLength = 11 };
    char adjusted_device[NameLength];

    serial_initialize(serial);

    /* COM ポートを開く */
    _snprintf(adjusted_device, NameLength, "\\\\.\\%s", device);
    serial->hCom = CreateFileA(adjusted_device, GENERIC_READ | GENERIC_WRITE,
                               0, NULL, OPEN_EXISTING,
                               FILE_ATTRIBUTE_NORMAL, NULL);

    if (serial->hCom == INVALID_HANDLE_VALUE) {
        // !!! store error_message buffer
        //printf("open failed: %s\n", device);
        return -1;
    }

    /* 通信サイズの更新 */
    SetupComm(serial->hCom, 4096 * 8, 4096);

    /* ボーレートの変更 */
    serial_set_baudrate(serial, baudrate);

    /* シリアル制御構造体の初期化 */
    serial->has_last_ch = False;

    /* タイムアウトの設定 */
    serial->current_timeout = 0;
    set_timeout(serial, serial->current_timeout);

    return 0;
}
开发者ID:OspreyX,项目名称:urg_c,代码行数:35,代码来源:urg_serial_windows.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_timer函数代码示例发布时间:2022-05-30
下一篇:
C++ set_time函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap