本文整理汇总了C++中CAF_LOG_TRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ CAF_LOG_TRACE函数的具体用法?C++ CAF_LOG_TRACE怎么用?C++ CAF_LOG_TRACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CAF_LOG_TRACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CAF_LOG_TRACE
void abstract_broker::configure_read(connection_handle hdl,
receive_policy::config cfg) {
CAF_LOG_TRACE(CAF_ARG(hdl) << CAF_ARG(cfg));
auto x = by_id(hdl);
if (x)
x->configure_read(cfg);
}
示例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: CAF_LOG_TRACE
downstream_manager::path_ptr
downstream_manager::add_path(stream_slot slot, strong_actor_ptr target) {
CAF_LOG_TRACE(CAF_ARG(slot) << CAF_ARG(target));
unique_path_ptr ptr{new outbound_path(slot, std::move(target))};
auto result = ptr.get();
return insert_path(std::move(ptr)) ? result : nullptr;
}
示例4: CAF_LOG_TRACE
bool monitorable_actor::cleanup(error&& reason, execution_unit* host) {
CAF_LOG_TRACE(CAF_ARG(reason));
attachable_ptr head;
bool set_fail_state = exclusive_critical_section([&]() -> bool {
if (!getf(is_cleaned_up_flag)) {
// local actors pass fail_state_ as first argument
if (&fail_state_ != &reason)
fail_state_ = std::move(reason);
attachables_head_.swap(head);
flags(flags() | is_terminated_flag | is_cleaned_up_flag);
on_cleanup();
return true;
}
return false;
});
if (!set_fail_state)
return false;
CAF_LOG_DEBUG("cleanup" << CAF_ARG(id())
<< CAF_ARG(node()) << CAF_ARG(reason));
// send exit messages
for (attachable* i = head.get(); i != nullptr; i = i->next.get())
i->actor_exited(reason, host);
// tell printer to purge its state for us if we ever used aout()
if (getf(abstract_actor::has_used_aout_flag)) {
auto pr = home_system().scheduler().printer();
pr->enqueue(make_mailbox_element(nullptr, make_message_id(), {},
delete_atom::value, id()),
nullptr);
}
return true;
}
示例5: CAF_LOG_TRACE
void manager::init(actor_system_config&) {
CAF_LOG_TRACE("");
ERR_load_crypto_strings();
OPENSSL_add_all_algorithms_conf();
SSL_library_init();
SSL_load_error_strings();
if (authentication_enabled()) {
if (system().config().openssl_certificate.size() == 0)
CAF_RAISE_ERROR("No certificate configured for SSL endpoint");
if (system().config().openssl_key.size() == 0)
CAF_RAISE_ERROR("No private key configured for SSL endpoint");
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L
std::lock_guard<std::mutex> lock{init_mutex};
++init_count;
if (init_count == 1) {
mutexes = std::vector<std::mutex>(CRYPTO_num_locks());
CRYPTO_set_locking_callback(locking_function);
CRYPTO_set_dynlock_create_callback(dynlock_create);
CRYPTO_set_dynlock_lock_callback(dynlock_lock);
CRYPTO_set_dynlock_destroy_callback(dynlock_destroy);
// OpenSSL's default thread ID callback should work, so don't set our own.
}
#endif
}
示例6: CAF_LOG_TRACE
void manager::detach(execution_unit*, bool invoke_disconnect_message) {
CAF_LOG_TRACE(CAF_ARG(invoke_disconnect_message));
// This function gets called from the multiplexer when an error occurs or
// from the broker when closing this manager. In both cases, we need to make
// sure this manager does not receive further socket events.
remove_from_loop();
// Disconnect from the broker if not already detached.
if (!detached()) {
CAF_LOG_DEBUG("disconnect servant from broker");
auto raw_ptr = parent();
// Keep a strong reference to our parent until we go out of scope.
strong_actor_ptr ptr;
ptr.swap(parent_);
detach_from(raw_ptr);
if (invoke_disconnect_message) {
auto mptr = make_mailbox_element(nullptr, invalid_message_id,
{}, detach_message());
switch (raw_ptr->consume(*mptr)) {
case im_success:
raw_ptr->finalize();
break;
case im_skipped:
raw_ptr->push_to_cache(std::move(mptr));
break;
case im_dropped:
CAF_LOG_INFO("broker dropped disconnect message");
break;
}
}
}
}
示例7: CAF_LOG_TRACE
strong_actor_ptr proxy_registry::get_or_put(const key_type& nid, actor_id aid) {
CAF_LOG_TRACE(CAF_ARG(nid) << CAF_ARG(aid));
auto& result = proxies_[nid][aid];
if (!result)
result = backend_.make_proxy(nid, aid);
return result;
}
示例8: CAF_PUSH_AID
void private_thread::run() {
auto job = const_cast<scheduled_actor*>(self_);
CAF_PUSH_AID(job->id());
CAF_LOG_TRACE("");
scoped_execution_unit ctx{&job->system()};
auto max_throughput = std::numeric_limits<size_t>::max();
bool resume_later;
for (;;) {
state_ = await_resume_or_shutdown;
do {
resume_later = false;
switch (job->resume(&ctx, max_throughput)) {
case resumable::resume_later:
resume_later = true;
break;
case resumable::done:
intrusive_ptr_release(job->ctrl());
return;
case resumable::awaiting_message:
intrusive_ptr_release(job->ctrl());
break;
case resumable::shutdown_execution_unit:
return;
}
} while (resume_later);
// wait until actor becomes ready again or was destroyed
if (!await_resume())
return;
}
}
示例9: join
/// Causes this actor to subscribe to the group `what`.
/// The group will be unsubscribed if the actor finishes execution.
void join(const group& what) {
CAF_LOG_TRACE(CAF_ARG(what));
if (what == invalid_group)
return;
if (what->subscribe(dptr()->ctrl()))
subscriptions_.emplace(what);
}
示例10: stop
void stop() override {
CAF_LOG_TRACE("");
// shutdown workers
class shutdown_helper : public resumable, public ref_counted {
public:
resumable::resume_result resume(execution_unit* ptr, size_t) override {
CAF_LOG_DEBUG("shutdown_helper::resume => shutdown worker");
CAF_ASSERT(ptr != nullptr);
std::unique_lock<std::mutex> guard(mtx);
last_worker = ptr;
cv.notify_all();
return resumable::shutdown_execution_unit;
}
void intrusive_ptr_add_ref_impl() override {
intrusive_ptr_add_ref(this);
}
void intrusive_ptr_release_impl() override {
intrusive_ptr_release(this);
}
shutdown_helper() : last_worker(nullptr) {
// nop
}
std::mutex mtx;
std::condition_variable cv;
execution_unit* last_worker;
};
// use a set to keep track of remaining workers
shutdown_helper sh;
std::set<worker_type*> alive_workers;
auto num = num_workers();
for (size_t i = 0; i < num; ++i) {
alive_workers.insert(worker_by_id(i));
sh.ref(); // make sure reference count is high enough
}
CAF_LOG_DEBUG("enqueue shutdown_helper into each worker");
while (!alive_workers.empty()) {
(*alive_workers.begin())->external_enqueue(&sh);
// since jobs can be stolen, we cannot assume that we have
// actually shut down the worker we've enqueued sh to
{ // lifetime scope of guard
std::unique_lock<std::mutex> guard(sh.mtx);
sh.cv.wait(guard, [&] { return sh.last_worker != nullptr; });
}
alive_workers.erase(static_cast<worker_type*>(sh.last_worker));
sh.last_worker = nullptr;
}
// shutdown utility actors
stop_actors();
// wait until all workers are done
for (auto& w : workers_) {
w->get_thread().join();
}
// run cleanup code for each resumable
auto f = &abstract_coordinator::cleanup_and_release;
for (auto& w : workers_)
policy_.foreach_resumable(w.get(), f);
policy_.foreach_central_resumable(this, f);
}
示例11: start
void start() {
CAF_ASSERT(this_thread_.get_id() == std::thread::id{});
auto this_worker = this;
this_thread_ = std::thread{[this_worker] {
CAF_LOG_TRACE(CAF_ARG(this_worker->id()));
this_worker->run();
}};
}
示例12: CAF_LOG_TRACE
void local_actor::quit(uint32_t reason) {
CAF_LOG_TRACE("reason = " << reason << ", class "
<< detail::demangle(typeid(*this)));
planned_exit_reason(reason);
if (is_blocking()) {
throw actor_exited(reason);
}
}
示例13: CAF_LOG_TRACE
void outbound_path::emit_irregular_shutdown(local_actor* self,
stream_slots slots,
const strong_actor_ptr& hdl,
error reason) {
CAF_LOG_TRACE(CAF_ARG(slots) << CAF_ARG(hdl) << CAF_ARG(reason));
unsafe_send_as(self, hdl,
make<downstream_msg::forced_close>(slots, self->address(),
std::move(reason)));
}
示例14: CAF_LOG_TRACE
bool abstract_actor::remove_backlink_impl(const actor_addr& other) {
CAF_LOG_TRACE(CAF_TSARG(other));
default_attachable::observe_token tk{other, default_attachable::link};
if (other && other != this) {
guard_type guard{mtx_};
return detach_impl(tk, attachables_head_, true) > 0;
}
return false;
}
示例15: CAF_ASSERT
void actor_registry::await_running_count_equal(size_t expected) const {
CAF_ASSERT(expected == 0 || expected == 1);
CAF_LOG_TRACE(CAF_ARG(expected));
std::unique_lock<std::mutex> guard{running_mtx_};
while (running_ != expected) {
CAF_LOG_DEBUG(CAF_ARG(running_.load()));
running_cv_.wait(guard);
}
}