~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to erts/emulator/beam/erl_db_hash.h

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-08-05 20:54:29 UTC
  • mfrom: (6.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090805205429-pm4pnwew8axraosl
Tags: 1:13.b.1-dfsg-5
* Fixed parentheses in Emacs mode (closes: #536891).
* Removed unnecessary conflicts with erlang-manpages package.
* Added workaround for #475459: disabled threads on sparc architecture.
  This breaks wxErlang, so it's only a temporary solution.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    DbTerm dbterm;         /* The actual term */
34
34
} HashDbTerm;
35
35
 
 
36
#define DB_HASH_LOCK_CNT 16
 
37
typedef struct db_table_hash_fine_locks {
 
38
    union {
 
39
        erts_smp_rwmtx_t lck;
 
40
        byte _cache_line_alignment[64];
 
41
    }lck_vec[DB_HASH_LOCK_CNT];
 
42
} DbTableHashFineLocks;
 
43
 
36
44
typedef struct db_table_hash {
37
45
    DbTableCommon common;
38
46
 
39
 
    /* Hash-specific fields */
40
 
    FixedDeletion *fixdel;      /*
41
 
                                 * List of slots where elements have
42
 
                                 * been deleted while table is fixed.
43
 
                                 */
44
 
    HashDbTerm ***seg;          /* The actual table */
45
 
 
46
 
    /* Hash-specific fields, 32-bit quantities */
47
 
    int szm;          /* current size mask */
48
 
    int nactive;      /* Number of "active" slots */
 
47
    erts_smp_atomic_t segtab;  /* The segment table (struct segment**) */
 
48
    erts_smp_atomic_t szm;     /* current size mask. */
 
49
    
 
50
    /* SMP: nslots and nsegs are protected by is_resizing or table write lock */
49
51
    int nslots;       /* Total number of slots */
50
 
    int p;            /* Split position */
51
 
    int nsegs;        /* Number of segments */
 
52
    int nsegs;        /* Size of segment table */
 
53
 
 
54
    /* List of slots where elements have been deleted while table was fixed */
 
55
    erts_smp_atomic_t fixdel;  /* (FixedDeletion*) */   
 
56
    erts_smp_atomic_t nactive; /* Number of "active" slots */
 
57
    erts_smp_atomic_t is_resizing; /* grow/shrink in progress */
 
58
#ifdef ERTS_SMP
 
59
    DbTableHashFineLocks* locks;
 
60
#endif
52
61
} DbTableHash;
53
62
 
 
63
 
54
64
/*
55
65
** Function prototypes, looks the same (except the suffix) for all 
56
66
** table types. The process is always an [in out] parameter.
57
67
*/
58
68
void db_initialize_hash(void);
59
69
void db_unfix_table_hash(DbTableHash *tb /* [in out] */);
 
70
Uint db_kept_items_hash(DbTableHash *tb);
60
71
 
61
72
/* Interface for meta pid table */
62
73
int db_create_hash(Process *p, 
63
74
                   DbTable *tbl /* [in out] */);
64
75
 
65
 
int db_put_hash(Process *p, DbTable *tbl, Eterm obj, Eterm *ret);
 
76
int db_put_hash(DbTable *tbl, Eterm obj, int key_clash_fail);
66
77
 
67
78
int db_get_hash(Process *p, DbTable *tbl, Eterm key, Eterm *ret);
68
79
 
69
 
int db_erase_hash(Process *p, DbTable *tbl, Eterm key, Eterm *ret);
 
80
int db_erase_hash(DbTable *tbl, Eterm key, Eterm *ret);
70
81
 
71
82
int db_get_element_array(DbTable *tbl, 
72
83
                         Eterm key,