diff options
Diffstat (limited to 'src/triplet.c')
-rw-r--r-- | src/triplet.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/triplet.c b/src/triplet.c index d9e503f..3f8536c 100644 --- a/src/triplet.c +++ b/src/triplet.c @@ -352,30 +352,34 @@ void triplet_enqueue(struct wy_triplet *trp) { pthread_t tid; - + struct spool *spool = trp->spool; if (!trp) return; - if (spool_open_dictionaries(trp->spool)) - return; - switch (check_triplet_state(trp)) { - case triplet_directive: - case triplet_complete: - triplet_list_lock(&triplet_pending_list); - triplet_list_unlink(&triplet_pending_list, trp); - triplet_list_unlock(&triplet_pending_list); + timer_start("spool"); + timer_start(spool->name); + if (spool_open_dictionaries(spool) == 0) { + switch (check_triplet_state(trp)) { + case triplet_directive: + case triplet_complete: + triplet_list_lock(&triplet_pending_list); + triplet_list_unlink(&triplet_pending_list, trp); + triplet_list_unlock(&triplet_pending_list); - triplet_list_lock(&triplet_running_list); - triplet_list_insert(&triplet_running_list, trp, - triplet_running_list.tail, 1); - triplet_list_unlock(&triplet_running_list); - - pthread_create(&tid, NULL, wy_thr_triplet, trp); - break; - case triplet_incomplete: - break; - case triplet_bad: - remove_triplet(trp); + triplet_list_lock(&triplet_running_list); + triplet_list_insert(&triplet_running_list, trp, + triplet_running_list.tail, 1); + triplet_list_unlock(&triplet_running_list); + + pthread_create(&tid, NULL, wy_thr_triplet, trp); + break; + case triplet_incomplete: + break; + case triplet_bad: + remove_triplet(trp); + } } + timer_stop(spool->name); + timer_stop("spool"); } /* Unlink all parts of the triplet TRP */ @@ -428,7 +432,7 @@ triplet_commit(struct wy_triplet *trp) process_directives(trp); timer_stop(trp->spool->tag); } - timer_stop("spool"); + timer_stop("spool"); } void @@ -544,10 +548,7 @@ void * wy_thr_triplet(void *ptr) { struct wy_triplet *trp = ptr; - timer_start("wydawca"); - spool_create_timers(); triplet_commit(trp); - timer_stop("wydawca"); logstats(); remove_triplet(trp); return NULL; @@ -604,7 +605,7 @@ try_timer_var(char **retval, char const *var, size_t len, char **timers) wydawca_timer_t t = NULL; if (member(timers, ws.ws_wordv[1])) - t = timer_stop(ws.ws_wordv[1]); + t = timer_get(ws.ws_wordv[1]); if (t) { double (*tfn) (wydawca_timer_t) = NULL; |