Re: Configuration locking



The lock works quite a bit like a lock on a thread, only there is far less information you can get from it. If you want something more full featured, you will have to build your own. Before doing that, consider the next question and response very carefully:

How often are you updating configs on a multi-user application? If the values you are looking at are routinely changed, they would be better in a persistant store than a configuration file.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Ralf" <Ralf@xxxxxxxxxxxxxxxx> wrote in message news:uhjgInhLJHA.1156@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

in an application I'm using a non trivial configuration,
implemented with classes from the System.Configuration namespace.
The parameters will be written to the app.exe.config file.
My application is stored on a network device and can be used from
more than one user at the same time.
To prevent the parameters for competing access, I want to lock
the parameters during one user is editing these parameters.

The ConfigurationElement class has lock functionality: ConfigurationElement.LockItem.
But I can't find any background informations about the locking mechanism.

Does anyone works with the locking mechanism?
I have a few questions about this:

1. Can I use LockItem for multi user locking?
2. How can I get the information which user is locking the parameters at the moment?
3. How can I manually unlock the parameters if a lock is lost?
4. How does it work?
5. Is there a better way for configuration locking?

Regards
Ralf

.



Relevant Pages

  • Re: using clustered index to optimize inserts ...
    ... I will try to explain locking in terms of Sybase docs... ... Allpages Locking: Allpages locking locks both data pages and index ... the data page is locked with an exclusive lock. ... Clustered Index: The datarows will be arranged as per the clustered ...
    (comp.databases.sybase)
  • Re: CSingleLock - known behaviour?
    ... It is better to design code that doesn't require locking. ... If you don't need the resource, don't lock it. ... magnitude less efficient, than locking once. ...
    (microsoft.public.vc.mfc)
  • Re: Strange multi-user timing phenomenon
    ... table record with pessimistic locking and both edit the same record. ... the recordset will be sufficient to lock out other users. ... update the recordset (if you had to edit data) and then close it. ...
    (microsoft.public.access.formscoding)
  • Re: CMultiLock example
    ... Seriously, though, locking is *mandatory* if two or more threads are accessing non-scalar ... lists ever be modified while the threads are running. ... without a lock. ... You must prevent that one piece of data is modified from multiple ...
    (microsoft.public.vc.mfc)
  • Re: Strange multi-user timing phenomenon
    ... I tried your locking method using a perssimistic recordset and it appears to ... user places his lock and grabs the same record. ... I would try opening a fixed single-row recordset with pessimistic locking, ...
    (microsoft.public.access.formscoding)