您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ timeout_add函数代码示例

51自学网 2021-06-03 08:50:59
  C++
这篇教程C++ timeout_add函数代码示例写得很实用,希望能帮到您。

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

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

示例1: conn_input

void conn_input (int sockfd, short event, void* arg){    g_print("%d :conn input %d/n", sockfd, event);    connection_t *conn = NULL;    if ( arg ){        conn = (connection_t *)arg;    }    if ( EV_TIMEOUT == event )    {        printf("arg is %p, timeout/n", arg);        event_add (&conn->ev_read, NULL);    	timeout_add(&conn->ev_read, &conn->tv);    }    if ( EV_READ == event)    {        printf("arg is %p, read data/n", arg);        event_add (&conn->ev_read, NULL);    	timeout_add(&conn->ev_read, &conn->tv);        evbuffer_read(conn->input, conn->sockfd, 256);    }}
开发者ID:zhangyuchi,项目名称:cpptestzj,代码行数:26,


示例2: domaininit

voiddomaininit(void){	struct domain *dp;	struct protosw *pr;	static struct timeout pffast_timeout;	static struct timeout pfslow_timeout;#undef unix	/*	 * KAME NOTE: ADDDOMAIN(route) is moved to the last part so that	 * it will be initialized as the *first* element.  confusing!	 */#ifndef lint	ADDDOMAIN(unix);#ifdef INET	ADDDOMAIN(inet);#endif#ifdef INET6	ADDDOMAIN(inet6);#endif /* INET6 */#if defined (KEY) || defined (IPSEC) || defined (TCP_SIGNATURE)	pfkey_init();#endif /* KEY || IPSEC */#ifdef MPLS       ADDDOMAIN(mpls);#endif#ifdef NATM	ADDDOMAIN(natm);#endif#ifdef IPSEC#ifdef __KAME__	ADDDOMAIN(key);#endif#endif#if NBLUETOOTH > 0	ADDDOMAIN(bt);#endif	ADDDOMAIN(route);#endif	for (dp = domains; dp; dp = dp->dom_next) {		if (dp->dom_init)			(*dp->dom_init)();		for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)			if (pr->pr_init)				(*pr->pr_init)();	}	if (max_linkhdr < 16)		/* XXX */		max_linkhdr = 16;	max_hdr = max_linkhdr + max_protohdr;	max_datalen = MHLEN - max_hdr;	timeout_set(&pffast_timeout, pffasttimo, &pffast_timeout);	timeout_set(&pfslow_timeout, pfslowtimo, &pfslow_timeout);	timeout_add(&pffast_timeout, 1);	timeout_add(&pfslow_timeout, 1);}
开发者ID:sofuture,项目名称:bitrig,代码行数:58,


示例3: connection_init_streams

static void connection_init_streams(struct connection *conn){	const struct connection_settings *set = &conn->list->set;	i_assert(conn->io == NULL);	i_assert(conn->input == NULL);	i_assert(conn->output == NULL);	i_assert(conn->to == NULL);	conn->version_received = set->major_version == 0;	if (set->input_max_size != 0) {		conn->input = i_stream_create_fd(conn->fd_in,						 set->input_max_size, FALSE);		i_stream_set_name(conn->input, conn->name);	}	if (set->output_max_size != 0) {		conn->output = o_stream_create_fd(conn->fd_out,						  set->output_max_size, FALSE);		o_stream_set_no_error_handling(conn->output, TRUE);		o_stream_set_name(conn->output, conn->name);	}	conn->io = io_add(conn->fd_in, IO_READ, *conn->list->v.input, conn);	if (set->input_idle_timeout_secs != 0) {		conn->to = timeout_add(set->input_idle_timeout_secs*1000,				       connection_idle_timeout, conn);	}	if (set->major_version != 0 && !set->dont_send_version) {		o_stream_nsend_str(conn->output, t_strdup_printf(			"VERSION/t%s/t%u/t%u/n", set->service_name_out,			set->major_version, set->minor_version));	}}
开发者ID:jkerihuel,项目名称:dovecot,代码行数:33,


示例4: connection_client_connect

int connection_client_connect(struct connection *conn){	const struct connection_settings *set = &conn->list->set;	int fd;	i_assert(conn->list->set.client);	i_assert(conn->fd_in == -1);	if (conn->port != 0)		fd = net_connect_ip(&conn->ip, conn->port, NULL);	else		fd = net_connect_unix(conn->name);	if (fd == -1)		return -1;	conn->fd_in = conn->fd_out = fd;	if (conn->port != 0) {		conn->io = io_add(conn->fd_out, IO_WRITE,				  connection_ip_connected, conn);		if (set->client_connect_timeout_msecs != 0) {			conn->to = timeout_add(set->client_connect_timeout_msecs,					       connection_connect_timeout, conn);		}	} else {		connection_client_connected(conn, TRUE);	}	return 0;}
开发者ID:jkerihuel,项目名称:dovecot,代码行数:28,


示例5: client_handle_unfinished_cmd

bool client_handle_unfinished_cmd(struct client_command_context *cmd){	if (cmd->state == CLIENT_COMMAND_STATE_WAIT_INPUT) {		/* need more input */		return FALSE;	}	if (cmd->state != CLIENT_COMMAND_STATE_WAIT_OUTPUT) {		/* waiting for something */		if (cmd->state == CLIENT_COMMAND_STATE_WAIT_SYNC) {			/* this is mainly for APPEND. */			client_add_missing_io(cmd->client);		}		return TRUE;	}	/* output is blocking, we can execute more commands */	o_stream_set_flush_pending(cmd->client->output, TRUE);	if (cmd->client->to_idle_output == NULL) {		/* disconnect sooner if client isn't reading our output */		cmd->client->to_idle_output =			timeout_add(CLIENT_OUTPUT_TIMEOUT_MSECS,				    client_idle_output_timeout, cmd->client);	}	return TRUE;}
开发者ID:Dexus,项目名称:ubuntu-trusty-dovecot,代码行数:25,


示例6: idle_add_keepalive_timeout

static void idle_add_keepalive_timeout(struct cmd_idle_context *ctx){	unsigned int interval = ctx->client->set->imap_idle_notify_interval;	unsigned int client_hash;	if (interval == 0)		return;	/* set the interval so that the client gets the keepalive notifications	   at exactly the same time for all the connections. this helps to	   reduce battery usage in mobile devices. but we don't really want to	   send this notification for everyone at the same time, because it	   would cause huge peaks of activity.	   basing the notifications on the username works well for one account,	   but basing it on the IP address allows the client to get all of the	   notifications at the same time for multiple accounts as well (of	   course assuming Dovecot is running on all the servers :)	   one potential downside to using IP is that if a proxy hides the	   client's IP address notifications are sent to everyone at the same	   time, but this can be avoided by using a properly configured Dovecot	   proxy. we'll also try to avoid this by not doing it for the commonly	   used intranet IP ranges. */	client_hash = ctx->client->user->remote_ip != NULL &&		remote_ip_is_usable(ctx->client->user->remote_ip) ?		net_ip_hash(ctx->client->user->remote_ip) :		crc32_str(ctx->client->user->username);	interval -= (time(NULL) + client_hash) % interval;	if (ctx->keepalive_to != NULL)		timeout_remove(&ctx->keepalive_to);	ctx->keepalive_to = timeout_add(interval * 1000,					keepalive_timeout, ctx);}
开发者ID:Distrotech,项目名称:dovecot,代码行数:35,


示例7: pop3c_client_connect_ip

static void pop3c_client_connect_ip(struct pop3c_client *client){	struct stat st;	client->fd = net_connect_ip(&client->ip, client->set.port, NULL);	if (client->fd == -1) {		pop3c_client_disconnect(client);		return;	}	client->input = client->raw_input =		i_stream_create_fd(client->fd, POP3C_MAX_INBUF_SIZE, FALSE);	client->output = client->raw_output =		o_stream_create_fd(client->fd, (size_t)-1, FALSE);	o_stream_set_no_error_handling(client->output, TRUE);	if (*client->set.rawlog_dir != '/0' &&	    client->set.ssl_mode != POP3C_CLIENT_SSL_MODE_IMMEDIATE &&	    stat(client->set.rawlog_dir, &st) == 0) {		iostream_rawlog_create(client->set.rawlog_dir,				       &client->input, &client->output);	}	client->io = io_add(client->fd, IO_WRITE,			    pop3c_client_connected, client);	client->to = timeout_add(POP3C_CONNECT_TIMEOUT_MSECS,				 pop3c_client_timeout, client);	if (client->set.debug) {		i_debug("pop3c(%s): Connecting to %s:%u", client->set.host,			net_ip2addr(&client->ip), client->set.port);	}}
开发者ID:Distrotech,项目名称:dovecot,代码行数:31,


示例8: login_proxy_connect

static int login_proxy_connect(struct login_proxy *proxy){	struct login_proxy_record *rec;	rec = login_proxy_state_get(proxy_state, &proxy->ip, proxy->port);	if (timeval_cmp(&rec->last_failure, &rec->last_success) > 0 &&	    rec->last_failure.tv_sec - rec->last_success.tv_sec > PROXY_IMMEDIATE_FAILURE_SECS &&	    rec->num_waiting_connections != 0) {		/* the server is down. fail immediately */		i_error("proxy(%s): Host %s:%u is down",			proxy->client->virtual_user, proxy->host, proxy->port);		login_proxy_free(&proxy);		return -1;	}	proxy->server_fd = net_connect_ip(&proxy->ip, proxy->port, NULL);	if (proxy->server_fd == -1) {		proxy_log_connect_error(proxy);		login_proxy_free(&proxy);		return -1;	}	proxy->server_io = io_add(proxy->server_fd, IO_WRITE,				  proxy_wait_connect, proxy);	if (proxy->connect_timeout_msecs != 0) {		proxy->to = timeout_add(proxy->connect_timeout_msecs,					proxy_connect_timeout, proxy);	}	proxy->state_rec = rec;	proxy->state_rec->num_waiting_connections++;	return 0;}
开发者ID:Distrotech,项目名称:dovecot,代码行数:32,


示例9: imxuartclose

intimxuartclose(dev_t dev, int flag, int mode, struct proc *p){	int unit = DEVUNIT(dev);	struct imxuart_softc *sc = imxuart_cd.cd_devs[unit];	bus_space_tag_t iot = sc->sc_iot;	bus_space_handle_t ioh = sc->sc_ioh;	struct tty *tp = sc->sc_tty;	int s;	/* XXX This is for cons.c. */	if (!ISSET(tp->t_state, TS_ISOPEN))		return 0;	(*linesw[tp->t_line].l_close)(tp, flag, p);	s = spltty();	if (ISSET(tp->t_state, TS_WOPEN)) {		/* tty device is waiting for carrier; drop dtr then re-raise */		CLR(sc->sc_ucr3, IMXUART_CR3_DSR);		bus_space_write_2(iot, ioh, IMXUART_UCR3, sc->sc_ucr3);		timeout_add(&sc->sc_dtr_tmo, hz * 2);	} else {		/* no one else waiting; turn off the uart */		imxuart_pwroff(sc);	}	CLR(tp->t_state, TS_BUSY | TS_FLUSH);	sc->sc_cua = 0;	splx(s);	ttyclose(tp);	return 0;}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:33,


示例10: client_command_free

void client_command_free(struct client_command_context **_cmd){	struct client_command_context *cmd = *_cmd;	struct client *client = cmd->client;	enum client_command_state state = cmd->state;	*_cmd = NULL;	i_assert(client->output_cmd_lock == NULL);	/* reset input idle time because command output might have taken a	   long time and we don't want to disconnect client immediately then */	client->last_input = ioloop_time;	timeout_reset(client->to_idle);	if (cmd->cancel) {		cmd->cancel = FALSE;		client_send_tagline(cmd, "NO Command cancelled.");	}	if (!cmd->param_error)		client->bad_counter = 0;	if (client->input_lock == cmd)		client->input_lock = NULL;	if (client->mailbox_change_lock == cmd)		client->mailbox_change_lock = NULL;	if (client->free_parser == NULL) {		imap_parser_reset(cmd->parser);		client->free_parser = cmd->parser;	} else if (cmd->parser != NULL) {		imap_parser_unref(&cmd->parser);	}	client->command_queue_size--;	DLLIST_REMOVE(&client->command_queue, cmd);	cmd = NULL;	if (client->command_queue == NULL) {		/* no commands left in the queue, we can clear the pool */		p_clear(client->command_pool);		if (client->to_idle_output != NULL)			timeout_remove(&client->to_idle_output);	}	imap_client_notify_command_freed(client);	imap_refresh_proctitle();	/* if command finished from external event, check input for more	   unhandled commands since we may not be executing from client_input	   or client_output. */	if (state == CLIENT_COMMAND_STATE_WAIT_EXTERNAL &&	    !client->disconnected) {		client_add_missing_io(client);		if (client->to_delayed_input == NULL) {			client->to_delayed_input =				timeout_add(0, client_input, client);		}	}}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:60,


示例11: heartbeat

/* * turn the heartbeat alive. * right thing would be to pass counter to each subsequent timeout * as an argument to heartbeat() incrementing every turn, * i.e. avoiding the static hbcnt, but doing timeout_set() on each * timeout_add() sounds ugly, guts of struct timeout looks ugly * to ponder in even more. */voidheartbeat(void *v){	static u_int hbcnt = 0, ocp_total, ocp_idle;	int toggle, cp_mask, cp_total, cp_idle;	timeout_add(&heartbeat_tmo, hz / 16);	cp_idle = cp_time[CP_IDLE];	cp_total = cp_time[CP_USER] + cp_time[CP_NICE] + cp_time[CP_SYS] +	    cp_time[CP_INTR] + cp_time[CP_IDLE];	if (cp_total == ocp_total)		cp_total = ocp_total + 1;	if (cp_idle == ocp_idle)		cp_idle = ocp_idle + 1;	cp_mask = 0xf0 >> (cp_idle - ocp_idle) * 4 / (cp_total - ocp_total);	cp_mask &= 0xf0;	ocp_total = cp_total;	ocp_idle = cp_idle;	/*	 * do this:	 *	 *   |~| |~|	 *  _| |_| |_,_,_,_	 *   0 1 2 3 4 6 7	 */	toggle = 0;	if (hbcnt++ < 8 && hbcnt & 1)		toggle = PALED_HEARTBEAT;	hbcnt &= 15;	ledctl(cp_mask,	    (~cp_mask & 0xf0) | PALED_NETRCV | PALED_NETSND | PALED_DISK,	    toggle);}
开发者ID:bradla,项目名称:OpenBSD-Hammer2,代码行数:42,


示例12: mail_crypt_cache_open

static struct istream *mail_crypt_cache_open(struct mail_crypt_user *muser, struct mail *mail,		      struct istream *input){	struct mail_crypt_cache *cache = &muser->cache;	struct istream *inputs[2];	string_t *temp_prefix = t_str_new(128);	mail_crypt_cache_close(muser);	input->seekable = FALSE;	inputs[0] = input;	inputs[1] = NULL;	mail_user_set_get_temp_prefix(temp_prefix, mail->box->storage->user->set);	input = i_stream_create_seekable_path(inputs,				i_stream_get_max_buffer_size(inputs[0]),				str_c(temp_prefix));	i_stream_unref(&inputs[0]);	if (mail->uid > 0) {		cache->to = timeout_add(MAIL_CRYPT_MAIL_CACHE_EXPIRE_MSECS,				mail_crypt_cache_close, muser);		cache->box = mail->box;		cache->uid = mail->uid;		cache->input = input;		/* index-mail wants the stream to be destroyed at close, so create		   a new stream instead of just increasing reference. */		return i_stream_create_limit(cache->input, (uoff_t)-1);	}	return input;}
开发者ID:manuelm,项目名称:dovecot,代码行数:32,


示例13: mbox_mailbox_open_existing

static int mbox_mailbox_open_existing(struct mbox_mailbox *mbox){	struct mailbox *box = &mbox->box;	const char *rootdir;	bool move_to_memory;	if (access(box->path, R_OK|W_OK) < 0) {		if (errno != EACCES) {			mbox_set_syscall_error(mbox, "access()");			return -1;		}		mbox->box.backend_readonly = TRUE;	}	move_to_memory = want_memory_indexes(mbox->storage, box->path);	if (box->inbox_any || strcmp(box->name, "INBOX") == 0) {		/* if INBOX isn't under the root directory, it's probably in		   /var/mail and we want to allow privileged dotlocking */		rootdir = mailbox_list_get_path(box->list, NULL,						MAILBOX_LIST_PATH_TYPE_DIR);		if (strncmp(box->path, rootdir, strlen(rootdir)) != 0)			mbox->mbox_privileged_locking = TRUE;	}	if ((box->flags & MAILBOX_FLAG_KEEP_LOCKED) != 0) {		if (mbox_lock(mbox, F_WRLCK, &mbox->mbox_global_lock_id) <= 0)			return -1;		if (mbox->mbox_dotlock != NULL) {			mbox->keep_lock_to =				timeout_add(MBOX_LOCK_TOUCH_MSECS,					    mbox_lock_touch_timeout, mbox);		}	}	return index_storage_mailbox_open(box, move_to_memory);}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:35,


示例14: mail_session_connect_parse

int mail_session_connect_parse(const char *const *args, const char **error_r){	struct mail_session *session;	const char *session_id;	pid_t pid;	struct ip_addr ip;	unsigned int i;	/* <session id> <username> <service> <pid> [key=value ..] */	if (str_array_length(args) < 4) {		*error_r = "CONNECT: Too few parameters";		return -1;	}	session_id = args[0];	if (str_to_pid(args[3], &pid) < 0) {		*error_r = t_strdup_printf("CONNECT: Invalid pid %s for session ID %s",					   args[3], session_id);		return -1;	}	session = hash_table_lookup(mail_sessions_hash, session_id);	if (session != NULL) {		*error_r = t_strdup_printf(			"CONNECT: Duplicate session ID %s for user %s service %s",			session_id, args[1], args[2]);		return -1;	}	session = i_malloc(sizeof(struct mail_session) + stats_alloc_size());	session->stats = (void *)(session + 1);	session->refcount = 1; /* unrefed at disconnect */	session->id = i_strdup(session_id);	session->service = str_table_ref(services, args[2]);	session->pid = pid;	session->last_update = ioloop_timeval;	session->to_idle = timeout_add(MAIL_SESSION_IDLE_TIMEOUT_MSECS,				       mail_session_idle_timeout, session);	session->user = mail_user_login(args[1]);	for (i = 3; args[i] != NULL; i++) {		if (strncmp(args[i], "rip=", 4) == 0 &&		    net_addr2ip(args[i] + 4, &ip) == 0)			session->ip = mail_ip_login(&ip);	}	hash_table_insert(mail_sessions_hash, session->id, session);	DLLIST_PREPEND_FULL(&stable_mail_sessions, session,			    stable_prev, stable_next);	DLLIST2_APPEND_FULL(&mail_sessions_head, &mail_sessions_tail, session,			    sorted_prev, sorted_next);	DLLIST_PREPEND_FULL(&session->user->sessions, session,			    user_prev, user_next);	mail_user_ref(session->user);	if (session->ip != NULL) {		DLLIST_PREPEND_FULL(&session->ip->sessions, session,				    ip_prev, ip_next);		mail_ip_ref(session->ip);	}	global_memory_alloc(mail_session_memsize(session));	return 0;}
开发者ID:jfsmig,项目名称:dovecot-core,代码行数:60,


示例15: lmtp_client_connect

static int lmtp_client_connect(struct lmtp_client *client){	i_assert(client->fd == -1);	client->times.connect_started = ioloop_timeval;	client->fd = net_connect_ip(&client->ip, client->port, NULL);	if (client->fd == -1) {		i_error("lmtp client: connect(%s, %u) failed: %m",			client->host, client->port);		return -1;	}	client->input = i_stream_create_fd(client->fd, LMTP_MAX_LINE_LEN);	client->output = o_stream_create_fd(client->fd, (size_t)-1);	o_stream_set_no_error_handling(client->output, TRUE);	o_stream_set_flush_callback(client->output, lmtp_client_output, client);	/* we're already sending data in ostream, so can't use IO_WRITE here */	client->io = io_add(client->fd, IO_READ,			    lmtp_client_wait_connect, client);	if (client->set.timeout_secs > 0) {		client->to = timeout_add(client->set.timeout_secs*1000,					 lmtp_client_connect_timeout, client);	}	return 0;}
开发者ID:bechtoldt,项目名称:dovecot-core,代码行数:25,


示例16: aps_power

voidaps_power(int why, void *arg){	struct aps_softc *sc = (struct aps_softc *)arg;	bus_space_tag_t iot = sc->aps_iot;	bus_space_handle_t ioh = sc->aps_ioh;	unsigned char iobuf[16];	if (why != PWR_RESUME) {		timeout_del(&aps_timeout);		return;	}	/*	 * Redo the init sequence on resume, because APS is 	 * as forgetful as it is deaf.	 */	/* get APS mode */	iobuf[APS_CMD] = 0x13;	if (aps_do_io(iot, ioh, iobuf, APS_WRITE_0, APS_READ_1)	    || aps_init(iot, ioh))		printf("aps: failed to wake up/n");	else		timeout_add(&aps_timeout, (5 * hz) / 10);}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:25,


示例17: dnkbd_bell

/* * Bell routines. */voiddnkbd_bell(void *v, u_int period, u_int pitch, u_int volume){	struct dnkbd_softc *sc = v;	int ticks, s;	s = spltty();	if (pitch == 0 || period == 0 || volume == 0) {		if (ISSET(sc->sc_flags, SF_BELL_TMO)) {			timeout_del(&sc->sc_bellstop_tmo);			dnkbd_bellstop(v);		}	} else {		ticks = (period * hz) / 1000;		if (ticks <= 0)			ticks = 1;		if (!ISSET(sc->sc_flags, SF_BELL)) {			dnkbd_pollout(sc->sc_regs, DNCMD_PREFIX);			dnkbd_pollout(sc->sc_regs, DNCMD_BELL);			dnkbd_pollout(sc->sc_regs, DNCMD_BELL_ON);			SET(sc->sc_flags, SF_BELL);		}		if (ISSET(sc->sc_flags, SF_BELL_TMO))			timeout_del(&sc->sc_bellstop_tmo);		timeout_add(&sc->sc_bellstop_tmo, ticks);		SET(sc->sc_flags, SF_BELL_TMO);	}	splx(s);}
开发者ID:avsm,项目名称:openbsd-xen-sys,代码行数:36,


示例18: mbox_mailbox_open_existing

static int mbox_mailbox_open_existing(struct mbox_mailbox *mbox){	struct mailbox *box = &mbox->box;	const char *rootdir, *box_path = mailbox_get_path(box);	bool move_to_memory;	move_to_memory = want_memory_indexes(mbox->storage, box_path);	if (box->inbox_any || strcmp(box->name, "INBOX") == 0) {		/* if INBOX isn't under the root directory, it's probably in		   /var/mail and we want to allow privileged dotlocking */		rootdir = mailbox_list_get_root_forced(box->list,						       MAILBOX_LIST_PATH_TYPE_DIR);		if (strncmp(box_path, rootdir, strlen(rootdir)) != 0)			mbox->mbox_privileged_locking = TRUE;	}	if ((box->flags & MAILBOX_FLAG_KEEP_LOCKED) != 0) {		if (mbox_lock(mbox, F_WRLCK, &mbox->mbox_global_lock_id) <= 0)			return -1;		if (mbox->mbox_dotlock != NULL) {			mbox->keep_lock_to =				timeout_add(MBOX_LOCK_TOUCH_MSECS,					    mbox_lock_touch_timeout, mbox);		}	}	return mbox_mailbox_open_finish(mbox, move_to_memory);}
开发者ID:IvanKharpalev,项目名称:core,代码行数:28,


示例19: cdcef_txeof

voidcdcef_txeof(struct usbf_xfer *xfer, void *priv,    usbf_status err){	struct cdcef_softc *sc = priv;	struct ifnet *ifp = GET_IFP(sc);	int s;	s = splnet();#if 0	printf("cdcef_txeof: xfer=%p, priv=%p, %s/n", xfer, priv,	    usbf_errstr(err));#endif	ifp->if_timer = 0;	ifp->if_flags &= ~IFF_OACTIVE;	if (sc->sc_xmit_mbuf != NULL) {		m_freem(sc->sc_xmit_mbuf);		sc->sc_xmit_mbuf = NULL;	}	if (err)		ifp->if_oerrors++;	else		ifp->if_opackets++;	if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)		timeout_add(&sc->start_to, 1); /* XXX  */	splx(s);}
开发者ID:orumin,项目名称:openbsd-efivars,代码行数:32,


示例20: diskconf

/* * Now that we are fully operational, we can checksum the * disks, and using some heuristics, hopefully are able to * always determine the correct root disk. */voiddiskconf(){	extern struct timeout	scoop_checkdisk;	dev_t tmpdev;#if 0	/*	 * Configure root, swap, and dump area.  This is	 * currently done by running the same checksum	 * algorithm over all known disks, as was done in	 * /boot.  Then we basically fixup the *dev vars	 * from the info we gleaned from this.	 */	dkcsumattach();#endif	/*	 * XXX	 * zaurus bootblocks currently pass in "bsd" instead of	 * "device:bsd", or any such thing, making this a real pain.	 */	if (bootdv == NULL)		bootdv = parsedisk("wd0a", strlen("wd0a"), 0, &tmpdev);	if (bootdv == NULL)		printf("boot device: lookup '%s' failed./n", boot_file);	else		printf("boot device: %s/n", bootdv->dv_xname);	setroot(bootdv, 0, RB_USERREQ);	dumpconf();	timeout_add(&scoop_checkdisk, hz/25);}
开发者ID:mosconi,项目名称:openbsd,代码行数:39,


示例21: director_request

void director_request(struct director *dir, const char *username,		      director_request_callback *callback, void *context){	struct director_request *request;	unsigned int username_hash =		user_directory_get_username_hash(dir->users, username);	request = i_new(struct director_request, 1);	request->dir = dir;	request->create_time = ioloop_time;	request->username_hash = username_hash;	request->callback = callback;	request->context = context;	if (director_request_continue(request))		return;	/* need to queue it */	if (dir->to_request == NULL) {		dir->to_request =			timeout_add(DIRECTOR_REQUEST_TIMEOUT_SECS * 1000,				    director_request_timeout, dir);	}	array_append(&dir->pending_requests, &request, 1);}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:25,


示例22: templog_statemachine

static voidtemplog_statemachine(void){        switch (templog_state) {        case TEMPLOG_IDLE:        case TEMPLOG_SLEEPING:                onboard_led(ONBOARD_LED_ON);                timeout_add(&templog_timeout, templog_interval * 1000, read_temp_again, NULL);                ds_read(&ds, got_temp_data, NULL);                templog_state = TEMPLOG_READING;                onboard_led(ONBOARD_LED_OFF);                break;        case TEMPLOG_READING:                /* timeout was triggered before */                templog_state = TEMPLOG_SLEEPING;                break;        case TEMPLOG_STOPPING:                flash_flush_data(flash_pagepos, stop_flush_done, NULL);                flash_pagepos = 0;                templog_state = TEMPLOG_STOP_FLUSHING;                break;        case TEMPLOG_STOP_FLUSHING:                templog_state = TEMPLOG_STOPPED;                break;        case TEMPLOG_STOPPED:                break;        }}
开发者ID:corecode,项目名称:mchck-os,代码行数:28,


示例23: ukbd_intr

voidukbd_intr(struct uhidev *addr, void *ibuf, u_int len){	struct ukbd_softc *sc = (struct ukbd_softc *)addr;	struct ukbd_data *ud = &sc->sc_ndata;	int i;#ifdef UKBD_DEBUG	if (ukbddebug > 5) {		printf("ukbd_intr: data");		for (i = 0; i < len; i++)			printf(" 0x%02x", ((u_char *)ibuf)[i]);		printf("/n");	}#endif	ud->modifiers = 0;	for (i = 0; i < sc->sc_nmod; i++)		if (hid_get_data(ibuf, &sc->sc_modloc[i]))			ud->modifiers |= sc->sc_mods[i].mask;	memcpy(ud->keycode, (char *)ibuf + sc->sc_keycodeloc.pos / 8,	       sc->sc_nkeycode);	if (sc->sc_debounce && !sc->sc_polling) {		/*		 * Some keyboards have a peculiar quirk.  They sometimes		 * generate a key up followed by a key down for the same		 * key after about 10 ms.		 * We avoid this bug by holding off decoding for 20 ms.		 */		sc->sc_data = *ud;		timeout_add(&sc->sc_delay, hz / 50);#ifdef DDB	} else if (sc->sc_console_keyboard && !sc->sc_polling) {		/*		 * For the console keyboard we can't deliver CTL-ALT-ESC		 * from the interrupt routine.  Doing so would start		 * polling from inside the interrupt routine and that		 * loses bigtime.		 */		sc->sc_data = *ud;		timeout_add(&sc->sc_delay, 1);#endif	} else {		ukbd_decode(sc, ud);	}}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:47,


示例24: mec_init

intmec_init(struct ifnet *ifp){	struct mec_softc *sc = ifp->if_softc;	bus_space_tag_t st = sc->sc_st;	bus_space_handle_t sh = sc->sc_sh;	struct mec_rxdesc *rxd;	int i;	/* Cancel any pending I/O. */	mec_stop(ifp);	/* Reset device. */	mec_reset(sc);	/* Setup filter for multicast or promisc mode. */	mec_setfilter(sc);	/* Set the TX ring pointer to the base address. */	bus_space_write_8(st, sh, MEC_TX_RING_BASE, MEC_CDTXADDR(sc, 0));	sc->sc_txpending = 0;	sc->sc_txdirty = 0;	sc->sc_txlast = MEC_NTXDESC - 1;	/* Put RX buffers into FIFO. */	for (i = 0; i < MEC_NRXDESC; i++) {		rxd = &sc->sc_rxdesc[i];		rxd->rxd_stat = 0;		MEC_RXSTATSYNC(sc, i, BUS_DMASYNC_PREREAD);		MEC_RXBUFSYNC(sc, i, ETHER_MAX_LEN, BUS_DMASYNC_PREREAD);		bus_space_write_8(st, sh, MEC_MCL_RX_FIFO, MEC_CDRXADDR(sc, i));	}	sc->sc_rxptr = 0;#if 0	/* XXX no info */	bus_space_write_8(st, sh, MEC_TIMER, 0);#endif	/*	 * MEC_DMA_TX_INT_ENABLE will be set later otherwise it causes	 * spurious interrupts when TX buffers are empty.	 */	bus_space_write_8(st, sh, MEC_DMA_CONTROL,	    (MEC_RXD_DMAOFFSET << MEC_DMA_RX_DMA_OFFSET_SHIFT) |	    (MEC_NRXDESC << MEC_DMA_RX_INT_THRESH_SHIFT) |	    MEC_DMA_TX_DMA_ENABLE | /* MEC_DMA_TX_INT_ENABLE | */	    MEC_DMA_RX_DMA_ENABLE | MEC_DMA_RX_INT_ENABLE);	timeout_add(&sc->sc_tick_ch, hz);	ifp->if_flags |= IFF_RUNNING;	ifp->if_flags &= ~IFF_OACTIVE;	mec_start(ifp);	mii_mediachg(&sc->sc_mii);	return 0;}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:59,


示例25: login_client_destroyed

void login_client_destroyed(void){	if (clients == NULL && auth_client_to == NULL) {		auth_client_to = timeout_add(AUTH_CLIENT_IDLE_TIMEOUT_MSECS,					     auth_client_idle_timeout,					     auth_client);	}}
开发者ID:jkerihuel,项目名称:dovecot,代码行数:8,


示例26: mdbox_file_close_later

static void mdbox_file_close_later(struct mdbox_file *mfile){	if (mfile->storage->to_close_unused_files == NULL) {		mfile->storage->to_close_unused_files =			timeout_add(MDBOX_CLOSE_UNUSED_FILES_TIMEOUT_SECS*1000,				    mdbox_file_close_timeout, mfile->storage);	}}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:8,


示例27: aps_refresh

voidaps_refresh(void *arg){	struct aps_softc *sc = (struct aps_softc *)arg;	aps_refresh_sensor_data(sc);	timeout_add(&aps_timeout, (5 * hz) / 10);}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:8,



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


C++ timeout_del函数代码示例
C++ timeout函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。