Exemple #1
0
static ERL_NIF_TERM clear(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    int i=0;
    for(i=0; i<BUCKET_SIZE; i++) {
        if(hashmap[i]>0) {
            walk_hash(&hashmap[i],0,NULL, 1);
        }
    }
    return enif_make_atom(env, "ok");
}
Exemple #2
0
struct metronome_item * find_in_hash(char * key, int timestamp) {
    int hash = hash_n(key);

    if(hashmap[hash]==0) {
        hashmap[hash] = new_item(key);
        return hashmap[hash];
    }

    return walk_hash(&hashmap[hash], timestamp, key, 0);
}
Exemple #3
0
static ERL_NIF_TERM gc(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
    int i=0 , timestamp = 0;
    CHECK(enif_get_int(env, argv[0], &timestamp));
    for(i=0; i<BUCKET_SIZE; i++) {
        if(hashmap[i]>0) {
            walk_hash(&hashmap[i],timestamp,NULL, 0);
        }
    }
    return enif_make_atom(env, "ok");
}
Exemple #4
0
static void print_block_node(NODE *node)
{
    BLOCK *block = CAST_TO_BLOCK(node);
    printf("\n");
    walk_hash(block->table, print_table_entry, NULL);
}