X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=runtime%2Flwt.c;h=83e8ee1a1306ef8bfa3fc6ddab5bec357bf26c2b;hp=8212c5cf00ecaa072a0886f9e282f8a4e80b3ec6;hb=7899dce86342c50be9a52d148fa27375bdb5d218;hpb=269f52d6f8cd031692c83afaa05c389115d05bd0 diff --git a/runtime/lwt.c b/runtime/lwt.c index 8212c5c..83e8ee1 100644 --- a/runtime/lwt.c +++ b/runtime/lwt.c @@ -58,7 +58,7 @@ static inline void dump_record (FILE *file, int thread_id, lwt_record_t *r, uint int level = ((size_t)r->format >> 48) & 0xFF; if (flag_state_[(unsigned)flag] >= level) { char s[3] = {flag, level, '\0'}; - fprintf(file, "%09llu %d %s ", ((uint64_t)r->timestamp - offset) >> 6, thread_id, s); + fprintf(file, "%09llu %d %s ", ((uint64_t)r->timestamp - offset) >> 5, thread_id, s); const char *format = (const char *)((size_t)r->format & MASK(48)); // strip out the embedded flags fprintf(file, format, r->value1, r->value2); fprintf(file, "\n"); @@ -80,6 +80,10 @@ static void dump_buffer (FILE *file, int thread_id, uint64_t offset) } } +void lwt_halt (void) { + halt_ = 1; +} + void lwt_dump (const char *file_name) { halt_ = 1; @@ -115,7 +119,7 @@ void lwt_dump (const char *file_name) } void lwt_trace_i (const char *format, size_t value1, size_t value2) { - if (*(volatile int *)&halt_) + if (halt_) return; LOCALIZE_THREAD_LOCAL(tid_, int); lwt_buffer_t *tb = lwt_buf_[tid_];