Rocket U2 | UniVerse & UniData

 View Only

 uv / LOCK / waiters

Manu Fernandes's profile image
PARTNER Manu Fernandes posted 06-02-2022 07:58
hi everybody,

question how to known the LOCK waiters : -- 
a/ session1 set a task synchronization lock  with LOCK 9   
b/ session2 will set a task synchronization lock  with LOCK 9  without PROMPT NO.WAIT nor  ELSE on basic. (yes bad coding but legacy :-)
then session2 is suspended until session1 UNLOCK 9 

So, for admin point of view, is there a method to list 'LOCK ' waiters ?
like ... session2 wait for lock 9 owned by session1  

actually, my solution is to perform PORT.STATUS PORT 2  + VLIST current program + check if adress line is  the command is LOCK ... 

any idea ? 
many thanks
manu
Dale Kelley's profile image
Dale Kelley
Hey Manu,
I decided those held LOCK's could be defeated.  Don't know if you could do with legacy code but I wrote a subroutine to update every file, it LOCKs the record, checks to insure that the record matches the original saved read, writes it and unLOCKs.  I only call it if the user has changed the record. Legacy code can make that a difficult process, just a suggestion.
Dale
Neil Morris's profile image
ROCKETEER Neil Morris
Hi Manu,
I'm only aware of being able to obtain the owner of the LOCK via the LIST.LOCKS command. I don't think currently there is any specific command to find waiters. Beyond changing the code, your approach of using PORT.STATUS and VLIST seems reasonable.
Thanks,
Neil
Jonathan Smith's profile image
ROCKETEER Jonathan Smith
Manu,

In UniData there is a LIST.QUEUE command which shows not only the read waiters for the semaphore locks used by the 'LOCK' command but also lists the READU / READL and filelock waiters as well. Starting at UniVerse 12 the internal lock structure used in UniVerse was changed to used the UniData model as UniData has a fairer.better and more efficient internal locking mechanism.  Internally we are discussing a proposal of adding the LIST.QUEUE command functionality as an enhancement to UniVerse 12. For reference starting at UniVerse 12 the engineering interface commands where also added that allow you to see the read waiters and semaphore LOCKs simply.

For anyone interested  I do have a presentation I did internally on the UniData and UniVerse 12 lock structures and tools that I can make avaialable. Please remember the information applies to UniData and UniVerse 12 onwards only.

Thanks,
Jonathan
Jonathan Smith's profile image
ROCKETEER Jonathan Smith
I have tried to attach the presentation to this link but the add attachment does not seem to be working at the moment. If anyone is interested in the presentation let me know and I'll find a way of getting it shared.
Manu Fernandes's profile image
PARTNER Manu Fernandes

hi Jonathan

yes, please publish your presentation.

thanks
manu