/* Called when the both the headers and content body (if any) are complete. */ int basic_parser::do_message_complete () { complete_ = true; on_complete(); return 0; }
void gkr_operation_complete (GkrOperation *op, MateKeyringResult res) { g_return_if_fail (op); if (gkr_operation_set_result (op, res)) on_complete (op); }
void Tween::on_tick(Uint32 now) { bool is_complete = 0; Uint32 elapsed = now - cycle_start_time - total_pause_time; if (elapsed >= duration) { is_complete = 1; elapsed = duration; } float t_normal = (float) elapsed / duration; float eased = ease_func(t_normal); if (control->is_reversed()) eased = 1 - eased; form->tick(eased); // check is_active because tween tick could have stopped the tween if (!is_active() || !is_complete) { return; } control->cycle_complete(); if (control->is_animation_complete()) { stop(); on_complete(last_cycle_complete_time); return; } // begin repeat cycle cycle_start_time += elapsed; last_cycle_complete_time = 0; }
static gboolean on_complete_later (gpointer data) { GkrOperation *op = data; /* Often we've already responded by the time the callback hits */ if (!g_queue_is_empty (&op->callbacks)) on_complete (op); return FALSE; /* Don't run idle handler again */ }
void Task::start() { boost::mutex::scoped_lock lock(m_mutex); m_begin = time(NULL); m_status = RUNNING; lock.unlock(); run(); lock.lock(); if (m_status == RUNNING) { m_status = COMPLETED; m_end = time(NULL); m_cond.notify_all(); //可能有多个线程同时在wait task lock.unlock(); on_complete(); } }
void Transport_parser::parse(const char* data, size_t len) { if(transport_ != nullptr) { transport_->load_cargo(data, len); } else { transport_ = std::make_unique<Transport>(Header::parse(data)); if(on_header) on_header(transport_->header()); len -= sizeof(Header); transport_->load_cargo(data + sizeof(Header), len); } if(transport_->is_complete()) on_complete(std::move(transport_)); }
MateKeyringResult gkr_operation_block_and_unref (GkrOperation *op) { DBusPendingCall *pending; g_return_val_if_fail (op, BROKEN); while ((int) gkr_operation_get_result (op) == INCOMPLETE) { if (op->pending) { /* * DBus has strange behavior that can complete a pending call * in another thread and somehow does this without calling our * on_pending_call_notify. So guard against this brokenness. */ pending = op->pending; dbus_pending_call_block (pending); if (op->pending == pending) { g_return_val_if_fail (dbus_pending_call_get_completed (pending), BROKEN); on_pending_call_notify (pending, op); g_assert (op->pending != pending); } } else if (op->prompting) { dbus_connection_flush (op->conn); while (op->prompting && (int) gkr_operation_get_result (op) == INCOMPLETE) { if (!dbus_connection_read_write_dispatch (op->conn, 200)) break; } } else { g_assert_not_reached (); } } /* Make sure we have run our callbacks if complete */ if (!g_queue_is_empty (&op->callbacks)) on_complete (op); return gkr_operation_unref_get_result (op); }
axis2_status_t AXIS2_CALL axis2_stub_on_complete_IIp2Location_get(axis2_callback_t *callback, const axutil_env_t *env) { axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, adb_getResponse_t* _getResponse, void *data); struct axis2_stub_IIp2Location_get_callback_data* callback_data = NULL; void *user_data = NULL; axis2_status_t status = AXIS2_SUCCESS; adb_getResponse_t* ret_val; axiom_node_t *ret_node = NULL; axiom_soap_envelope_t *soap_envelope = NULL; callback_data = (struct axis2_stub_IIp2Location_get_callback_data*)axis2_callback_get_data(callback); soap_envelope = axis2_callback_get_envelope(callback, env); if(soap_envelope) { axiom_soap_body_t *soap_body; soap_body = axiom_soap_envelope_get_body(soap_envelope, env); if(soap_body) { axiom_soap_fault_t *soap_fault = NULL; axiom_node_t *body_node = axiom_soap_body_get_base_node(soap_body, env); if(body_node) { ret_node = axiom_node_get_first_child(body_node, env); } } } user_data = callback_data->data; on_complete = callback_data->on_complete; if(ret_node != NULL) { ret_val = adb_getResponse_create(env); if(adb_getResponse_deserialize(ret_val, env, &ret_node, NULL, AXIS2_FALSE ) == AXIS2_FAILURE) { AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the LendResponse_deserialize: " "This should be due to an invalid XML"); adb_getResponse_free(ret_val, env); ret_val = NULL; } } else { ret_val = NULL; } status = on_complete(env, ret_val, user_data); if(callback_data) { AXIS2_FREE(env->allocator, callback_data); } return status; }