本文整理汇总了C++中reset_timeout函数的典型用法代码示例。如果您正苦于以下问题:C++ reset_timeout函数的具体用法?C++ reset_timeout怎么用?C++ reset_timeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reset_timeout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: debug
dbuf_t *check_reasm_done(reasm_pile_struct_t *rp, reasm_chunk_t *chk, uint16_t hoffs1, uint16_t hoffs0,
char *data, uint16_t len, uint16_t offs, int more) {
dbuf_t *d = chk->d;
if (!more) {
debug(DBG_REASM, 20, "Set desired length %d <= %d + %d\n", chk->esize, offs, len);
chk->esize = offs+len;
}
memcpy(&chk->d->buf[offs], data, len);
reset_timeout(rp, chk);
if (d->dsize < offs+len) {
d->dsize = offs+len;
}
debug(DBG_REASM, 20, "Offs: %d, len: %d, chk->esize: %d, chk->hole: %d, d->dsize: %d",
offs, len, chk->esize, chk->hole, d->dsize);
debug_dump(DBG_REASM, 100, d->buf, d->size);
if (chk->esize == chk->hole) {
/*
* reassembly complete. Delete chunk, and return the dbuf.
* do not unlock since we should have locked it anyway
*/
d->dsize = chk->esize;
dispose_chk(rp, chk);
return d;
}
return NULL;
}
示例2: CAF_LOG_TRACE
void blocking_actor::dequeue(behavior& bhvr, message_id mid) {
CAF_LOG_TRACE(CAF_MARG(mid, integer_value));
// try to dequeue from cache first
if (invoke_from_cache(bhvr, mid)) {
return;
}
// requesting an invalid timeout will reset our active timeout
uint32_t timeout_id = 0;
if (mid == invalid_message_id) {
timeout_id = request_timeout(bhvr.timeout());
} else {
request_sync_timeout_msg(bhvr.timeout(), mid);
}
// read incoming messages
for (;;) {
await_data();
auto msg = next_message();
switch (invoke_message(msg, bhvr, mid)) {
case im_success:
if (mid == invalid_message_id) {
reset_timeout(timeout_id);
}
return;
case im_skipped:
if (msg) {
push_to_cache(std::move(msg));
}
break;
default:
// delete msg
break;
}
}
}
示例3: operate_onewire_temp_measurement
// Keep conversions going on for each sensor on each onewire bus
void
operate_onewire_temp_measurement(void)
{
{
unsigned char register_testmask;
if (conv_complete)
{
// Not very nice to use a bitmap but we need to spare bytes for the stack to keep things safe:(
// This bitmap is used to keep track of register conversion initiation information
register_testmask = 0x01 << register_to_address;
// Evaluate side effect: Only read until read is succesful
if (register_conv_initiated & register_testmask)
read_DS18xxx(register_to_address);
register_conv_initiated &= ~register_testmask;
if (issue_convert_for_device(register_to_address))
register_conv_initiated |= register_testmask;
// Reset the conversion timer and set the complete flag so we
// can wait for conversion time expiry of the next device
reset_timeout(TEMP_CONV_TIMER);
conv_complete = FALSE;
if(++register_to_address == NR_OF_TEMP_SENSORS)
register_to_address = 0;
}
else
{
conv_complete = timeout_occured(TEMP_CONV_TIMER,
(DS18x20_CONV_TIME / NR_OF_TEMP_SENSORS) + 50);
}
}
}
示例4: on_read
static void on_read(h2o_socket_t *sock, const char *err)
{
struct st_h2o_tunnel_t *tunnel = sock->data;
h2o_socket_t *dst;
assert(tunnel != NULL);
assert(tunnel->sock[0] == sock || tunnel->sock[1] == sock);
if (err != NULL) {
close_connection(tunnel);
return;
}
if (sock->bytes_read == 0)
return;
h2o_socket_read_stop(sock);
reset_timeout(tunnel);
if (tunnel->sock[0] == sock)
dst = tunnel->sock[1];
else
dst = tunnel->sock[0];
h2o_iovec_t buf;
buf.base = sock->input->bytes;
buf.len = sock->input->size;
h2o_socket_write(dst, &buf, 1, on_write_complete);
}
示例5: request_timeout
void blocking_actor::dequeue(behavior& bhvr, message_id mid) {
// try to dequeue from cache first
if (invoke_from_cache(bhvr, mid)) {
return;
}
// requesting an invalid timeout will reset our active timeout
auto timeout_id = request_timeout(bhvr.timeout());
// read incoming messages
for (;;) {
await_data();
auto msg = next_message();
switch (invoke_message(msg, bhvr, mid)) {
case im_success:
reset_timeout(timeout_id);
return;
case im_skipped:
if (msg) {
push_to_cache(std::move(msg));
}
break;
default:
// delete msg
break;
}
}
}
示例6: operate_onewire_temp_measurement
// Keep conversions going on for each sensor on each onewire bus
void
operate_onewire_temp_measurement(void)
{
if (conv_complete)
{
switch (bus_to_address)
{
case 0:
if (bus0_conv_initiated)
read_DS18xxx(0);
bus0_conv_initiated = issue_convert_on_bus(0);
bus_to_address = 0;
break;
}
// Reset the conversion timer and set the complete flag so we
// can wait for conversion time expiry on the next bus
reset_timeout(TEMP_CONV_TIMER);
conv_complete = FALSE;
}
else
{
conv_complete = timeout_occured(TEMP_CONV_TIMER,
DS18x20_CONV_TIME / NR_OF_OW_BUSES);
}
}
示例7: verify_challenge
static void verify_challenge(CcnetProcessor *processor,
char *code, char *code_msg,
char *content, int clen)
{
CcnetKeepaliveProcPriv *priv = GET_PRIV (processor);
ccnet_debug ("[Conn] Verify Peer Challenge\n");
if (clen != 40 || memcmp(content, priv->random_buf, 40) != 0) {
ccnet_debug ("[Conn] Peer Challenge failed\n");
close_processor(processor);
return;
}
CcnetUser *user = ccnet_peer_get_user(processor->peer);
if (!user) {
ccnet_debug ("[Conn] No user for this peer, go to auth done\n");
processor->peer->auth_done = 1;
g_signal_emit_by_name (processor->peer, "auth-done");
send_keepalive (processor);
reset_timeout (processor);
return;
}
if (user->pubkey)
send_challenge_user(processor, user);
else
get_pubkey_user(processor);
}
示例8: next_wav
void next_wav(C* c)
{
if(wi >= G_N_ELEMENTS(wavs)){
if(iter++ < 2){
wi = 0;
}else{
g_free(c);
FINISH_TEST;
}
}
dbg(0, "==========================================================");
reset_timeout(40000);
Waveform* w = waveform_new(wavs[wi++]);
g_object_weak_ref((GObject*)w, finalize_notify, NULL);
waveform_load_sync(w);
#if 0 // due to internal changes, these tests are no longer valid
WfGlBlock* blocks = (WfGlBlock*)w->priv->render_data[MODE_MED];
assert(blocks, "texture container not allocated");
assert(!blocks->peak_texture[WF_LEFT].main[0], "textures allocated"); // no textures are expected to be allocated.
assert(!blocks->peak_texture[WF_RIGHT].main[0], "textures allocated");
#endif
assert(&w->priv->peak, "peak not loaded");
assert(w->priv->peak.size, "peak size not set");
assert(w->priv->peak.buf[WF_LEFT], "peak not loaded");
assert(w->priv->peak.buf[WF_RIGHT], "peak not loaded");
g_object_unref(w);
c->next(c);
}
示例9: get_pubkey_user
static void get_pubkey_user(CcnetProcessor *processor)
{
ccnet_processor_send_update (processor,
"320", NULL, NULL, 0);
processor->state = WAIT_PUBKEY_USER;
reset_timeout(processor);
}
示例10: upload_pack
static void upload_pack(void)
{
struct string_list symref = STRING_LIST_INIT_DUP;
head_ref_namespaced(find_symref, &symref);
if (advertise_refs || !stateless_rpc) {
reset_timeout();
head_ref_namespaced(send_ref, &symref);
for_each_namespaced_ref(send_ref, &symref);
advertise_shallow_grafts(1);
packet_flush(1);
} else {
head_ref_namespaced(mark_our_ref, NULL);
for_each_namespaced_ref(mark_our_ref, NULL);
}
string_list_clear(&symref, 1);
if (advertise_refs)
return;
receive_needs();
if (want_obj.nr) {
get_common_commits();
create_pack_file();
}
}
示例11: upload_pack
void upload_pack(struct upload_pack_options *options)
{
struct string_list symref = STRING_LIST_INIT_DUP;
stateless_rpc = options->stateless_rpc;
timeout = options->timeout;
daemon_mode = options->daemon_mode;
git_config(upload_pack_config, NULL);
head_ref_namespaced(find_symref, &symref);
if (options->advertise_refs || !stateless_rpc) {
reset_timeout();
head_ref_namespaced(send_ref, &symref);
for_each_namespaced_ref(send_ref, &symref);
advertise_shallow_grafts(1);
packet_flush(1);
} else {
head_ref_namespaced(check_ref, NULL);
for_each_namespaced_ref(check_ref, NULL);
}
string_list_clear(&symref, 1);
if (options->advertise_refs)
return;
receive_needs();
if (want_obj.nr) {
get_common_commits();
create_pack_file();
}
}
示例12: sapi_apache_read_post
/* {{{ sapi_apache_read_post
*/
static int sapi_apache_read_post(char *buffer, uint count_bytes TSRMLS_DC)
{
int total_read_bytes=0, read_bytes;
request_rec *r = (request_rec *) SG(server_context);
void (*handler)(int);
/*
* This handles the situation where the browser sends a Expect: 100-continue header
* and needs to receive confirmation from the server on whether or not it can send
* the rest of the request. RFC 2616
*
*/
if (!SG(read_post_bytes) && !ap_should_client_block(r)) {
return total_read_bytes;
}
handler = signal(SIGPIPE, SIG_IGN);
while (total_read_bytes<count_bytes) {
hard_timeout("Read POST information", r); /* start timeout timer */
read_bytes = get_client_block(r, buffer+total_read_bytes, count_bytes-total_read_bytes);
reset_timeout(r);
if (read_bytes<=0) {
break;
}
total_read_bytes += read_bytes;
}
signal(SIGPIPE, handler);
return total_read_bytes;
}
示例13: set_timeout
static void set_timeout(uint16_t ms)
{
// clock source is OSC32K
s_period_counter = BOARD_OSC32_HZ * ms / 1000;
// Reset the counter
reset_timeout();
}
示例14: lock
// called each time a goal is received
void ROSAction::goalCB()
{
std::cout << "****************************%%%%%%%%%% goalCB %%%%%%%%%%" << std::endl;
// could add conditions to accept goal or not
goal_ = as_.acceptNewGoal()->GOAL_;
std::cout << "Received Goal: " << goal_ << std::endl;
// send_feedback();
// if (!busy)
// {
// feedback_.FEEDBACK_ = NODE_ERROR;
// result_.RESULT_ = NODE_ERROR;
// }
if (feedback_.FEEDBACK_ != SUCCESS &&
feedback_.FEEDBACK_ != FAILURE)
{
bool started; // is thread running?
{
boost::lock_guard<boost::mutex> lock(mutex_started_);
started = started_;
}
std::cout << "started: " << started << std::endl;
if (started)
{
if (goal_ > 0) // possitive tick
reset_timeout();
else if (goal_ < 0) // negative tick
{
std::cout << "Got a negative tick" << std::endl;
stop();
}
else // neutral tick
{}
}
else
{
if (goal_ > 0) // possitive tick
start();
else if (goal_ < 0) // negative tick
{}
else // neutral tick
{}
}
}
if (feedback_.FEEDBACK_ == SUCCESS ||
feedback_.FEEDBACK_ == FAILURE)
{
boost::lock_guard<boost::mutex> lock_b(mutex_feedback_);
boost::lock_guard<boost::mutex> lock_c(mutex_result_);
feedback_.FEEDBACK_ = NODE_ERROR;
result_.RESULT_ = NODE_ERROR;
}
std::cout << "****************************%%%%%%%%%% goalCB Exit%%%%%%%%%%" << std::endl;
}
示例15: it_switch_mode
bool it_switch_mode(arg_t a) {
if (mode == MODE_IMAGE) {
if (tns.thumbs == NULL)
tns_init(&tns, filecnt, &win);
img_close(&img, false);
reset_timeout(reset_cursor);
if (img.slideshow) {
img.slideshow = false;
reset_timeout(slideshow);
}
tns.sel = fileidx;
tns.dirty = true;
mode = MODE_THUMB;
} else {
load_image(tns.sel);
mode = MODE_IMAGE;
}
return true;
}