diff options
Diffstat (limited to 'src/triplet.c')
-rw-r--r-- | src/triplet.c | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/src/triplet.c b/src/triplet.c index 47be116..3bdc2d4 100644 --- a/src/triplet.c +++ b/src/triplet.c @@ -524,49 +524,19 @@ wy_triplet_wait(void) triplet_list_unlock(&triplet_running_list); pthread_mutex_lock(&triplet_table_mutex); - n = grecs_symtab_count(triplet_table); + n = triplet_table ? grecs_symtab_count(triplet_table) : 0; pthread_mutex_unlock(&triplet_table_mutex); - *wy_get_stat_slot(WY_STAT_INCOMPLETE_TRIPLETS) += n; + wydawca_stat_add(WY_STAT_INCOMPLETE_TRIPLETS, n); } -static pthread_key_t key; -static pthread_once_t key_once = PTHREAD_ONCE_INIT; - -static void -stat_free(void *f) -{ - free(f); -} - -static void -make_key(void) -{ - pthread_key_create(&key, stat_free); -} - -WY_STAT_COUNTER * -wy_get_stat_array(void) -{ - WY_STAT_COUNTER *stat; - pthread_once(&key_once, make_key); - if ((stat = pthread_getspecific(key)) == NULL) { - stat = grecs_calloc(WY_MAX_STAT, sizeof(stat[0])); - pthread_setspecific(key, stat); - } - return stat; -} - void * wy_thr_triplet(void *ptr) { struct wy_triplet *trp = ptr; wy_set_cur_thread_name("triplet"); triplet_commit(trp); + wydawca_stat_update(); remove_triplet(trp); - if (wy_mode == WY_MODE_DAEMON) - logstats(); - else - wydawca_stats_update(); return NULL; } |