Hello - we're trying to write a lock manager which shows the user what cells are currently write-locked in a certain library, by whom, and when the lock was created. We've got most of this in place already, including an option to release the write lock on a cell that you yourself have write-locked.
We are not using any Design Management system - just a plain-ol OA library on disk that multiple people point to.
As it is now, you have to manually refresh the locked file listing by clicking a button in the lock manager GUI. It would be excellent to get rid of that need: is there a good way to have the lock manager automatically refresh whenever a locked cell becomes unlocked, or when a previously unlocked cell gets locked by any user running on any node?
ddRegTrigger("PreObjAccess" 'stuff) works for a single user's session; you would have to make sure that each user is running that trigger (and its callback function) and you'd also have to work some form of IPC to get them to notify each other of changes.
Linux has some options like 'watch', which could also push out to all IPC listeners and would only have to run on one node, but it would be nice to not have a constantly running background application - but maybe it's not that computationally expensive?
Is there some lower-level linux file system trigger that sends notifications on file/dir changes, which IPC could listen for, or even better, is there actually an already-existing SKILL function to do said listening?
What's your recommended course of action for this type of listening?
A few comments:
We did something like this and we simply used hiRegTimer to check at a given frequency and update the form. If the action is very fast and lightweight this won't cause any issues and is the easiest way to keep a form refreshed. hiRegTimer tells Cadence to run a skill command some amount of time in the future. In 60 seconds it can refresh the form and then issue the next hiRegTimer.
In addition to Derek's comments, you might also find my little package which creates a simple interface around hiRegTimer to schedule repeating jobs useful: How to schedule a repeating function with a timer in SKILL?
The lock release is hopefully doing it 'the right way': (sorry the 'source code' tool doesn't seem to work - it doesn't bother to turn line breaks into <br>)
cv=dbOpenCellViewByType(libName cellName "layout" "" "r") ;; leaves it in write mode if already open
; note, even if the window banner doesn't look like it's descended, it may be descended ; and therefore would not match for either displayCellView or geGetCellViewWindow winMatch=geGetCellViewWindow(cv) if(winMatch then hiRaiseWindow(winMatch) hiSetCurrentWindow(winMatch) printf("Matching window: %L\n" winMatch) _leChangeEditMode("r") else printf("Sorry, no matching window for %L %L layout.\n" libName cellName) w=geOpen(?lib libName ?cell cellName ?view "layout" ?mode "r") _leChangeEditMode("r") hiCloseWindow(w) )
Never noticed that in the navigator - that's pretty handy. The one we're working on just shows a plain list (actually a report / table) of all cells in the library that are locked. With hundreds of cells in the library it's mainly just a space-saver vs the built-in solutions, and lets you see all the locks in one concise display.
It would be nice to add a context menu with 'notify me when this cell is freed' and 'request/nag'. Maybe auto-refresh / poll would not be needed unless you set 'notify' on one or more cells.
also some more relevant comments from the code:
; make sure we don't delete any unsaved edits! ; cell is in some window at top level (not descended)? --> raise that window then _leChangeEditMode("r") ; otherwise, open the cell in a new window in edit mode, then _leChangeEditMode("r") ; (this is safer than using dbReopen which says it will immediately discard edits, though it ; actually appears to preserve edits even though changing to read mode; presumably the user ; is prompted to save the cell on virtuoso exit ; ; It should be fine to also call _leChangeEditMode("r") for the currently viewed cell even if it ; is the result of edit-in-place. In this case it wouldn't match for displayCellView or ; geGetCellViewWindow, but, should match for ...