List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 28 1999 6:42pm
Subject:Re: Duplicated locking operation.
View as plain text  
At 1:35 PM -0500 7/28/99, Thimble Smith wrote:
>At 10:12, 19990728, Scott Hess wrote:
>>Just now, I noticed that if you try to aquire a lock that you already have,
>>mysql first releases the lock before aquiring it.
>>
>>Just wanted to double-check that this is how things are _intended_ to work,
>>rather than just a happy coincidence.  The documentation does not say.
>
>The docs do say.
>
>|`GET_LOCK(str,timeout)'
>|    ...
>|    A lock is released when you execute `RELEASE_LOCK()',
>|    execute a new `GET_LOCK()' or the thread terminates.
>|    ...
>|
>|        mysql> select GET_LOCK("lock1",10);
>|                 -> 1
>|         mysql> select GET_LOCK("lock2",10);
>|                 -> 1
>|         mysql> select RELEASE_LOCK("lock2");
>|                  -> 1
>|         mysql> select RELEASE_LOCK("lock1");
>|                  -> NULL
>|
>|    Note that the second `RELEASE_LOCK()' call returns `NULL' because
>|    the lock `"lock1"' was automatically released by the second
>|    `GET_LOCK()' call.
>
>Tim

No, that's different.  The example gets a lock that you *don't* already
have.  It's not clear whether this also applies to the situation
where you try to get a lock that you do already have, though empirically
that seems to be the case.

--
Paul DuBois, paul@stripped
Thread
Duplicated locking operation.Scott Hess28 Jul
  • Re: Duplicated locking operation.Thimble Smith28 Jul
    • Re: Duplicated locking operation.Paul DuBois28 Jul
  • Re: Duplicated locking operation.Scott Hess28 Jul