use lock while creating temp-file

This commit is contained in:
interp 2002-09-18 15:33:42 +00:00
parent 911c56e668
commit 78e8cb3777
1 changed files with 4 additions and 1 deletions

View File

@ -22,7 +22,7 @@
;;; that contains all SPACE-INFO objects (see below for SPACE-INFO).
;;;
;;;
;;; (MAKE-GNUPLOT-DATA output-file selector space-info-list)
;;; (WRITE-GNUPLOT-DATA-FILE output-file selector space-info-list)
;;;
;;; Creates a file named OUTPUT-FILE out of SPACE-INFO-LIST. The
;;; created file can be used with GNUPLOT (external program, not part
@ -107,13 +107,16 @@
(define *run-count* 0)
(define *temp-file-lock* (make-lock))
;; PROFILE-SPACE writes result of call to (SPACE) to a file
(define (profile-space . maybe-file-name)
(obtain-lock *temp-file-lock*)
(let ((file-name
(:optional maybe-file-name
(create-temp-file "/var/tmp/profile"))))
(let ((out (open-output-file file-name open/append)))
(release-lock *temp-file-lock*)
(set! *run-count* (+ 1 *run-count*))
(format out "~%Run #~a~%" *run-count*)
(with-current-output-port* out space)