Changeset 14c9aa6 in mainline for kernel/generic/include/adt/cht.h


Ignore:
Timestamp:
2012-07-27T13:40:19Z (12 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0949b7a
Parents:
4ec9ea41
Message:

cht: Added initial working concurrent hash table. Builds and runs.

File:
1 edited

Legend:

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

    r4ec9ea41 r14c9aa6  
    4040#include <synch/rcu.h>
    4141#include <macros.h>
     42#include <synch/workqueue.h>
    4243
    4344typedef uintptr_t cht_ptr_t;
     
    5354/** Set of operations for a concurrent hash table. */
    5455typedef struct cht_ops {
    55         size_t (*hash)(cht_link_t *node);
     56        size_t (*hash)(const cht_link_t *item);
    5657        size_t (*key_hash)(void *key);
    5758        bool (*equal)(const cht_link_t *item1, const cht_link_t *item2);
     
    7071        cht_ops_t *op;
    7172       
     73        size_t min_order;
    7274        cht_buckets_t *b;
    7375        cht_buckets_t *new_b;
     76
     77        work_t resize_work;
     78        atomic_t resize_reqs;
    7479       
    75         atomic_t resize_reqs;
    7680        atomic_t item_cnt;
    7781} cht_t;
     
    8488#define cht_read_unlock()   rcu_read_unlock()
    8589
    86 extern void cht_create(cht_t *h, size_t init_size, cht_ops_t *op);
     90extern bool cht_create(cht_t *h, size_t init_size, size_t min_size, cht_ops_t *op);
    8791extern void cht_destroy(cht_t *h);
    8892
    8993extern cht_link_t *cht_find(cht_t *h, void *key);
    9094extern cht_link_t *cht_find_lazy(cht_t *h, void *key);
     95extern cht_link_t *cht_find_next(cht_t *h, const cht_link_t *item);
     96extern cht_link_t *cht_find_next_lazy(cht_t *h, const cht_link_t *item);
     97
    9198extern void cht_insert(cht_t *h, cht_link_t *item);
    9299extern bool cht_insert_unique(cht_t *h, cht_link_t *item);
Note: See TracChangeset for help on using the changeset viewer.