locking items in a collection

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a collection of 10 named items from which I would like
to lock 1 to 10 items in a single request.  Multiple processes
may request "tokens" from the collection.  At any time 1 to 10
items of the collection can be assigned to unique process ids
during which time a lock is held on the token.

Each item must have a specific name, lock requests are made
for a count of items.  When items are unlocked, the unlock
request can use either a handle returned by the original
lock request, or in a special case - unlocked by a request
using its ordinal value(1 - 10).

Each of the ten items will be tied to a process id (and possibly
other arbitrary data).  When the process terminates the token
can be unlocked so that other processes may request a lock for
the token.

No two requests should be assigned the same token when multiple
requests for tokens occur simulaneously.

Is there a CPAN module that would provides this functionality?

Re: locking items in a collection

tkeith@mindspring.com (Tim Keith) wrote:
Quoted text here. Click to load it

Are "items" and "tokens" the same thing?

Quoted text here. Click to load it

Are you sure it isn't 0 to 10 of them?  Is the state of an item being
assigned to a process ids identical to the state of a process holding
a lock on a token, or are those two different actions?

Quoted text here. Click to load it

What is the point of them having specific names if they are not
asked for by that specific name?  What happens if the count can only
be partially satisfied?

Quoted text here. Click to load it

What does this mean?  Obviously, a process that holds a lock on a token
"knows" that it does so.  And a process can contain any aribtrary data,
and therefore can associate it with a token.  Is that not sufficient?  If
not, what else is required?  Does the lock server need to report to other
processes on who own certain locks?

Quoted text here. Click to load it

"Can be" or "must be"?  Is autodetection of dead connections allowed, or

Quoted text here. Click to load it

I was thinking of DBD::MySQL to work with MySQL lock manager (which
let's you coordinate locking of arbitrary string tokens), but it appears
that any connection can only hold one lock at a time.  That means each
client would need upto 10 separate connections, which would not be very

Are all the processes going to run ont the same machine? Are they all
going to be started by forking?  Or by threads?  Or independently?


-------------------- http://NewsReader.Com / --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB

Site Timeline