home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 19,249 of 19,505   
   rja.carnegie@gmail.com to Anton Shepelev   
   Re: Using sp_getapplock outside a transa   
   25 Nov 17 16:21:12   
   
   On Saturday, 25 November 2017 18:13:02 UTC, Anton Shepelev  wrote:   
   > rja.carnegie:   
   >   
   > > While  replying,  I noticed that sp_releaseapplock   
   > > takes @LockOwner as well.  So perhaps  that  needs   
   > > to be set to 'session' there.   
   >   
   > Ah, that's it.   
   >   
   > > In  one  session  you  will be allowed to lock the   
   > > same "resource" several times, because it  is  the   
   > > same session locking it.   
   >   
   > Then  per-transaction locks are the thing me.  Thank   
   > you.   
   >   
   > --   
   > Anton Shepelev   
      
   Well, I might be wrong about this anyway... but what I think   
   I mean - unless you find different - is that your script can   
   put two or three or a hundred locks on the same resource,   
   even exclusive use, because the lock is to reserve the resource   
   to you, and you can do that with multiple copies of the lock -   
   or rather, counts of the lock, because lighter and heavier   
   locks on the resource add up to the heaviest combination of   
   locking - and then it stays locked as heavily as that until   
   all of the locks are released.   
      
   But if you run the script in two windows, one window can   
   lock the resource, exclusively, and then the other window   
   can't have it.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca