The winlock Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The winlock Reference Manual

This is the winlock Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 06:31:52 2022 GMT+0.

Table of Contents


1 Introduction

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.


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 winlock

File locking using the Windows API.

Author

Paul M. Rodriguez <pmr@ruricolist.com>

License

MIT

Dependencies
  • serapeum (system).
  • cffi (system).
  • named-readtables (system).
Source

winlock.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 winlock/winlock.asd

Source

winlock.asd.

Parent Component

winlock (system).

ASDF Systems

winlock.


3.1.2 winlock/package.lisp

Source

winlock.asd.

Parent Component

winlock (system).

Packages

winlock.


3.1.3 winlock/readtable.lisp

Dependency

package.lisp (file).

Source

winlock.asd.

Parent Component

winlock (system).


Previous: , Up: Lisp   [Contents][Index]

3.1.4 winlock/winlock.lisp

If Feature

:windows

Dependency

readtable.lisp (file).

Source

winlock.asd.

Parent Component

winlock (system).


4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 winlock

Source

package.lisp.

Use List
  • alexandria.
  • cffi.
  • common-lisp.
  • editor-hints.named-readtables.
  • serapeum.
  • uiop/driver.

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables