pkg/lib: lock clean-up, and add `path->pkg'

Make the installed-package database lock reentrant, change some
functions to take the lock, and fix the documentation on when a
lock is expected to be taken outside of functions.

original commit: 10e53e3bf4
This commit is contained in:
Matthew Flatt 2013-04-16 08:49:22 -06:00
parent 77833ba35b
commit 4af90112d0

View File

@ -108,13 +108,10 @@
[l
(for-each do-test l)])]
[packages?
(unless (for*/or ([scope (in-list '(installation user shared))])
(define pd
(parameterize ([current-pkg-scope scope])
(with-handlers ([exn:fail? (λ (x) #f)])
(pkg-directory e))))
(and pd (do-test pd)))
(error 'test "Package ~e is not installed" e))]
(define pd (pkg-directory e))
(if pd
(do-test pd)
(error 'test "Package ~e is not installed" e))]
[else
(do-test e)]))