STLdb

PrevUpHomeNext

Class file_lock

stldb::file_lock

Synopsis

// In header: </Users/bobw/workspace/stldb_lib/stldb/sync/file_lock.h>


class file_lock : public ofstream {
public:
  // construct/copy/destruct
  file_lock(const char *);
  file_lock(const char *, offset_t, size_t);
  ~file_lock();

  // public member functions
  const char * filename() ;
};

Description

This is a file_lock which creates the file being locked, and destroys the file when the lock is released. Useful for cases where the file exists for no other purpose than to facilitate the lock

file_lock public construct/copy/destruct

  1. file_lock(const char * name);

    Opens a file lock. Throws interprocess_exception if the file does not exist or there are no operating system resources.

    Opens a file lock. Throws interprocess_exception if the file does not exist or there are no operating system resources.

  2. file_lock(const char * name, offset_t offset, size_t size);

    Opens a file lock. The lock is based on a portion of the file beginning at offset bytes from the start of the file, and extending from there for size bytes.

    Opens a file lock. The lock is based on a portion of the file beginning at offset bytes from the start of the file, and extending from there for size bytes.

  3. ~file_lock();
    Closes a file lock. Does not throw.

    Deletes the file.

file_lock public member functions

  1. const char * filename() ;

PrevUpHomeNext