[plt-scheme] hitting a race in logging?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Sun Aug 10 15:05:03 EDT 2008

I'm hitting slightly weird behavior when I'm logging events, but I
don't yet see why.  In DrScheme, the following program sometimes shows
"hello" as expected.  But sometimes it doesn't!

;;;;;;

#lang scheme

(define (start-up-debug-printing)
  (let ([receiver (make-log-receiver (current-logger) 'debug)])
    (void
     (thread (lambda ()
               (let loop ()
                 (let ([v (sync receiver)])
                   (display (vector-ref v 1))
                   (newline))
                 (loop)))))))
(start-up-debug-printing)

(log-warning "hello")
;;;;;;


If I press Run three times, the third time does not show output.  Am I
using the logging system properly?


Posted on the users mailing list.