Writing /giga/dw/dng/dokuwiki/data/meta/dev/010how/080cfg/0030inilock.meta failed
dev:010how:080cfg:0030inilock



INI-files locking for editing

In static data transactions DBxxxx where editing of ini-files takes place - there is the locking mechanism which prevents to edit the same file simultaneously by more than one session.

This is relevant for the following transactions:

  • DBISYS
  • DBITDC
  • DBITDH
  • DBITDP
  • DBITDR
  • DBITDT
  • DBIPRC
  • DBIMNU

When there is more than one ini-file that is edited by transaction - all required ini-files will be locked upon entering editing mode.

In case there is an existing lock on the required ini-file, editing will be cancelled with a status indicating the particular lock details.

Locking mechanism

The lock/unlock of the given ini-files happens in the following functions defined in module SLGNOI:

  • LockIniFiles( in ArgRec module, in ArgInifiles text )
  • FreeIniFiles( in ArgRec module )

Incoming parameters are:

  • ArgRec - REC-module associated with settings (e.g. SYS for DBISYS, TDP for DBITDP etc) that must contain field INR
  • ArgInifiles - CR-separated list of ini-files that have to be locked

When LockIniFiles called - for each ini-file name MAC is calculated and database entry with INR equals to calculated MAC is locked.

If module REC has own DB-table - it will be used for locking, otherwise, entry in common dummy DB-table INI is used

In case any of the ini-files are already locked or held:

  • Transaction Status will be updated with lock information
  • FreeIniFiles called
  • Transaction will return to caller.

When FreeIniFiles called - each entry that was previously locked by LockIniFiles is unlocked.

Implementation details

The ini-files locking implementation might be used for locking ini-files in custom transactions as well.

To have the locking mechanism active:

  • LockInifiles has to be called when entering a transaction for editing,
  • FreeInifiles has to be called when leaving transaction

For the standard implementation of DBIxxx/DBExxx with MDIBUT/MDEBUT - the following to be added to xxxP module (for example, SYSP in DBISYS):

  • Add SLGNOI
  • MdxButHandleDb4READLOCK - add call for LockIniFiles
  • MdxButHandleDb4FREE - add call for FreeInifiles
dev/010how/080cfg/0030inilock.txt · Last modified: 2024/04/05 10:10 (external edit)