Changeset 235d31d in mainline for kernel/generic/include/adt/list.h


Ignore:
Timestamp:
2014-12-22T17:47:40Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8c7d5ad
Parents:
eae91e0 (diff), 759ea0d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge the CHT pre-integration branch

This branch contains:

  • the merge of lp:~adam-hraska+lp/helenos/rcu, which brings:
  • a new preemptible kernel RCU variant called A-RCU,
  • a preemptible variant of Podzimek's non-preemptible kernel RCU and
  • a new variant of usersace RCU,
  • a new concurrent hash table (CHT) implementation based on RCU,
  • a deployment of CHT in kernel futex handling,
  • a deployment of the userspace RCU in the implementation of upgradable futexes,

all described in Adam Hraska's master thesis named Read-Copy-Update
for HelenOS, defended in 2013 at MFF UK; furthemore, the branch
fixes two synchronization bugs in condvars and waitq, respectively:

  • revid:adam.hraska+hos@gmail.com-20121116144921-3to9u1tn1sg07rg7
  • revid:adam.hraska+hos@gmail.com-20121116173623-km7gwtqixwudpe66
  • build fixes required to pass make check
  • overhaul of ia64 and sparc64 trap handling, to allow exc_dispatch() to be used now when the kernel is more picky about CPU state accounting
  • an important fix of the sparc64/sun4v preemptible trap handler
  • various other fixes of issues discovered on non-x86 architectures
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/adt/list.h

    reae91e0 r235d31d  
    5252} list_t;
    5353
     54
     55extern int list_member(const link_t *, const list_t *);
     56extern void list_splice(list_t *, link_t *);
     57extern unsigned int list_count(const list_t *);
     58
     59
    5460/** Declare and initialize statically allocated list.
    5561 *
     
    8086            _link != &(list).head; _link = _link->prev)
    8187
     88/** Unlike list_foreach(), allows removing items while traversing a list.
     89 *
     90 * @code
     91 * list_t mylist;
     92 * typedef struct item {
     93 *     int value;
     94 *     link_t item_link;
     95 * } item_t;
     96 *
     97 * //..
     98 *
     99 * // Print each list element's value and remove the element from the list.
     100 * list_foreach_safe(mylist, cur_link, next_link) {
     101 *     item_t *cur_item = list_get_instance(cur_link, item_t, item_link);
     102 *     printf("%d\n", cur_item->value);
     103 *     list_remove(cur_link);
     104 * }
     105 * @endcode
     106 *
     107 * @param list List to traverse.
     108 * @param iterator Iterator to the current element of the list.
     109 *             The item this iterator points may be safely removed
     110 *             from the list.
     111 * @param next_iter Iterator to the next element of the list.
     112 */
     113#define list_foreach_safe(list, iterator, next_iter) \
     114        for (link_t *iterator = (list).head.next, \
     115                *next_iter = iterator->next; \
     116                iterator != &(list).head; \
     117                iterator = next_iter, next_iter = iterator->next)
     118
     119       
    82120#define assert_link_not_used(link) \
    83121        ASSERT(!link_used(link))
     
    289327{
    290328        headless_list_split_or_concat(part1, part2);
     329}
     330
     331/** Concatenate two lists
     332 *
     333 * Concatenate lists @a list1 and @a list2, producing a single
     334 * list @a list1 containing items from both (in @a list1, @a list2
     335 * order) and empty list @a list2.
     336 *
     337 * @param list1         First list and concatenated output
     338 * @param list2         Second list and empty output.
     339 *
     340 */
     341NO_TRACE static inline void list_concat(list_t *list1, list_t *list2)
     342{
     343        list_splice(list2, list1->head.prev);
    291344}
    292345
     
    340393}
    341394
    342 extern int list_member(const link_t *, const list_t *);
    343 extern void list_concat(list_t *, list_t *);
    344 extern unsigned int list_count(const list_t *);
    345 
    346395#endif
    347396
Note: See TracChangeset for help on using the changeset viewer.