Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the winlock Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Sun May 15 06:27:37 2022 GMT+0.
• Introduction | What winlock is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Indexes | Concepts, functions, variables and data types |
Winlock is a library that allows locking a file, using system calls, on Windows.
(winlock:with-locked-file (#p"~/some/file")
(do-something))
The file can be opened for read, write, or both, and be shared (:shared t
) or exclusive (:shared nil
).
(with-locked-file (file :direction :input :shared t))
Defaults: :direction
defaults to :input
; :shared
defaults to t
if :direction
is :input
, and nil
otherwise. The direction can be any of :input
, :output
, or :io
.
Note that the file is not opened by locking it.
Besides with-locked-file
, there are also unbalanced lock-file
and unlock-handle
functions. (There is no unlock-file
; you have to save the handle returned by lock-file to pass to unlock-handle
.)
Caveat: the file that is locked is not actually the file itself, but another file with a .lock
extension. E.g. if you lock file.txt
, the actual lock is taken on file.txt.lock
. This is because once an exclusive lock is taken on a file, the file is accessible only through the handle used to lock it – even the same process cannot open the file with a different handle. You can circumvent this by calling lock-file
with :direct t
. In this case no lockfile is used and the file is locked directly.
Some code in this library (for error reporting) is adapted from winhttp.
This is intended as a building block for a portable file-locking library.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The winlock system |
Paul M. Rodriguez <pmr@ruricolist.com>
MIT
File locking using the Windows API.
winlock.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The winlock.asd file | ||
• The winlock/package.lisp file | ||
• The winlock/readtable.lisp file | ||
• The winlock/winlock.lisp file |
Next: The winlock/package․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
winlock.asd
winlock (system)
Next: The winlock/readtable․lisp file, Previous: The winlock․asd file, Up: Lisp files [Contents][Index]
Next: The winlock/winlock․lisp file, Previous: The winlock/package․lisp file, Up: Lisp files [Contents][Index]
package.lisp (file)
winlock (system)
readtable.lisp
Previous: The winlock/readtable․lisp file, Up: Lisp files [Contents][Index]
windows
readtable.lisp (file)
winlock (system)
winlock.lisp
Packages are listed by definition order.
• The winlock package |
package.lisp (file)
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L W |
---|
Jump to: | F L W |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | P S W |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
P | |||
Package, winlock : | The winlock package | ||
| |||
S | |||
System, winlock : | The winlock system | ||
| |||
W | |||
winlock : | The winlock system | ||
winlock : | The winlock package | ||
|
Jump to: | P S W |
---|