Sections

Locked File

The QtLockedFile class extends QFile with advisory locking functions.

This class extends the QFile class with inter-process file locking capabilities. If an application requires that several processes should access the same file, QtLockedFile can be used to easily ensure that only one process at a time is writing to the file, and that no process is writing to it while others are reading it.

Documentation:

Classes:

Tested on:

  • Qt 4.4, 4.5 / Windows XP / MSVC.NET 2005
  • Qt 4.4, 4.5 / Linux / gcc
  • Qt 4.4, 4.5 / MacOS X 10.5 / gcc

Unsupported platforms:

Only the tested platforms are supported, however the classes should be platform independent and are likely to work on the platforms supported by Qt.

Download Commercial Edition:

Only available for Qt Solutions license holders with a valid Support and Maintenance agreement (authentication required).

Download Open Source Edition (LGPL):

Changes:

  • 2.4: LGPL release.
  • 2.4: Windows: Reimplemented. Fixed issue where crashed processes could hold on to a lock.
  • 2.4: Misc. minor fixes.
  • 2.3: Windows: Bugfix; non-blocking lock attempt could cause locking failures later.
  • 2.2: Windows: Compilation fix for MinGW.
  • 2.2: Windows: Allow file names with paths.
  • 2.2: Windows: Possible deadlock removed.
  • 2.1: Fix non-blocking lock() on Windows.
  • 2.0: This is a port to Qt 4 of the latest Qt 3 version (1.1).
Document Actions