/* * We need to be careful when using other facilities that may use thread registry functions in * their normal operation. For example, we do not want to invoke the logger while holding a lock.
*/
/* Register the current thread and associate it with a data pointer. */ void vdo_register_thread(struct thread_registry *registry, struct registered_thread *new_thread, constvoid *pointer)
{ struct registered_thread *thread; bool found_it = false;
spin_lock(®istry->lock);
list_for_each_entry(thread, ®istry->links, links) { if (thread->task == current) { /* There should be no existing entry. */
list_del_rcu(&thread->links);
found_it = true; break;
}
}
list_add_tail_rcu(&new_thread->links, ®istry->links);
spin_unlock(®istry->lock);
VDO_ASSERT_LOG_ONLY(!found_it, "new thread not already in registry"); if (found_it) { /* Ensure no RCU iterators see it before re-initializing. */
synchronize_rcu();
INIT_LIST_HEAD(&thread->links);
}
}
VDO_ASSERT_LOG_ONLY(found_it, "thread found in registry"); if (found_it) { /* Ensure no RCU iterators see it before re-initializing. */
synchronize_rcu();
INIT_LIST_HEAD(&thread->links);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.