struct attr_hashmap {
struct hashmap map;
-#ifndef NO_PTHREADS
pthread_mutex_t mutex;
-#endif
};
static inline void hashmap_lock(struct attr_hashmap *map)
{
-#ifndef NO_PTHREADS
pthread_mutex_lock(&map->mutex);
-#endif
}
static inline void hashmap_unlock(struct attr_hashmap *map)
{
-#ifndef NO_PTHREADS
pthread_mutex_unlock(&map->mutex);
-#endif
}
/*
size_t nr;
size_t alloc;
struct attr_check **checks;
-#ifndef NO_PTHREADS
pthread_mutex_t mutex;
-#endif
} check_vector;
static inline void vector_lock(void)
{
-#ifndef NO_PTHREADS
pthread_mutex_lock(&check_vector.mutex);
-#endif
}
static inline void vector_unlock(void)
{
-#ifndef NO_PTHREADS
pthread_mutex_unlock(&check_vector.mutex);
-#endif
}
static void check_vector_add(struct attr_check *c)
void attr_start(void)
{
-#ifndef NO_PTHREADS
pthread_mutex_init(&g_attr_hashmap.mutex, NULL);
pthread_mutex_init(&check_vector.mutex, NULL);
-#endif
}