Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

WWW::Link_Controller::Lock
application locks on link database.

WWW::Link_Controller::Lock - application locks on link database.


NAME

WWW::Link_Controller::Lock - application locks on link database.


DESCRIPTION

This provides a very simple lock on the link database used for stopping multiple processes which write to the database starting at the same time.

We don't care about any of the other databases (e.g. schedule) 'cos they ain't that critical and can be easily reconstructed if needed... Hmm.

This should be replaced with something which works properly, probably based on transactions as implemented in postgress (all read only queries allways get an immediate answer, although it may be about a time in the past).


IMPLEMENTATION

We create a symbolic link related to the name of the database file with our process data in the target.

When the program ends we remove the lock automatically..

When we start up and the lock exists we tell the user the name of the lock and ask them to remove it.

When asked to verify the lock, we check that the process data matches our data.


ADVANTAGES

  • Easy for people to understand the locks

  • Should work over NFS etc..

  • Reasonably safe


FUNCTIONS

WWW::Link_Controller::Lock::lock($linkfile)

Creates our lock_file (actually a symlink); dies if it can't.

WWW::Link_Controller::Lock::checklock()

Checks that we still hold the lock we originally created. Used to minimise the chance of problems when the lock is broken by someone careless.

Use this on long running programs just before writing to the database.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy