The winlock Reference Manual

Table of Contents

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

The winlock Reference Manual

This is the winlock Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Dec 02 11:40:04 2019 GMT+0.


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

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.


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

2 Systems

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


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

2.1 winlock

Author

Paul M. Rodriguez <pmr@ruricolist.com>

License

MIT

Description

File locking using the Windows API.

Dependencies
Source

winlock.asd (file)

Components

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

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 files   [Contents][Index]

3.1.1 winlock.asd

Location

winlock.asd

Systems

winlock (system)


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

3.1.2 winlock/package.lisp

Parent

winlock (system)

Location

package.lisp

Packages

winlock


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

3.1.3 winlock/readtable.lisp

Dependency

package.lisp (file)

Parent

winlock (system)

Location

readtable.lisp


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

3.1.4 winlock/winlock.lisp

If Feature

windows

Dependency

readtable.lisp (file)

Parent

winlock (system)

Location

winlock.lisp


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

4 Packages

Packages are listed by definition order.


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

4.1 winlock

Source

package.lisp (file)

Use List

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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   W  
Index Entry  Section

F
File, Lisp, winlock.asd: The winlock․asd file
File, Lisp, winlock/package.lisp: The winlock/package․lisp file
File, Lisp, winlock/readtable.lisp: The winlock/readtable․lisp file
File, Lisp, winlock/winlock.lisp: The winlock/winlock․lisp file

L
Lisp File, winlock.asd: The winlock․asd file
Lisp File, winlock/package.lisp: The winlock/package․lisp file
Lisp File, winlock/readtable.lisp: The winlock/readtable․lisp file
Lisp File, winlock/winlock.lisp: The winlock/winlock․lisp file

W
winlock.asd: The winlock․asd file
winlock/package.lisp: The winlock/package․lisp file
winlock/readtable.lisp: The winlock/readtable․lisp file
winlock/winlock.lisp: The winlock/winlock․lisp file

Jump to:   F   L   W  

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

A.2 Functions


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

A.3 Variables


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

A.4 Data types

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