in reply to threads::shared - when to lock a hash ?
A shared resource, whether a variable or not, must be locked “anytime.” It is not merely to ensure that the value is not physically destroyed. There are two use-cases that must be guarded; they are separate but related.
The first requirement, not merely the second one, dictates the true and comprehensive need for locking. It applies not only in the Perl environment but also in every other situation.
Effective locking can be voluntary, e.g. the SELECT LOCK(name) capability of MySQL. If there is known to be complete and full-coverage cooperation among all possible accessors of a resource, process synchronization can be achieved by placing locks upon a pool of arbitrarily-named strings, provided that the protocol for constructing those strings is carefully and completely known by all.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: threads::shared - when to lock a hash ?
by BrowserUk (Patriarch) on Oct 16, 2011 at 14:19 UTC | |
|
Re^2: threads::shared - when to lock a hash ?
by Anonymous Monk on Oct 17, 2011 at 02:53 UTC | |
by locked_user sundialsvc4 (Abbot) on Oct 17, 2011 at 02:55 UTC |