User bio
404 bio not found
Member since Apr 27, 2017
Posts:
Replies:
I agree that both Streams extend from %Stream.Object, and yes, I noticed that the storage mechanisms are also different. I'm curious—what are the advantages of using DynamicBinary instead of TmpCharacter?
We can use the %SYS.LockQuery
class and its List
query function to check whether the global is already locked. If it is, we can skip attempting to acquire the lock.
Check for the specific process
ClassMethod LOCK(Lock, Mode)
{
If '..IsLocked("^A","X") {
Lock +^A
}
Else {
Write "Locked"
}
}
// X - Exclusive
// S - Shared
ClassMethod IsLocked(Global As %String, Mode As %String)
{
#dim status = 0
Set tResult = ##class(%SYS.LockQuery).ListFunc($J)
While tResult.%Next() {
If tResult.Mode=Mode&&(tResult.LockString=Global) Set status= 1
}
Return status
}
However, the above code only checks for a specific process and does not account for other processes with Xclusive or Shared locks. The sample below checks for all acquired locks, returning their status and lock type.
ClassMethod IsLocked(Global As %String, Mode As %String)
{
#dim status = 0
Set tResult = ##class(%SYS.LockQuery).ListFunc()
While tResult.%Next() {
If tResult.LockString=Global {
If tResult.Mode?1(1"X",1"S") Set status= 1_","_tResult.Mode
}
}
Return status #; status be like "1,S" or "1,X"
}
Open Exchange applications:
Certifications & Credly badges:
Ashok Kumar has no Certifications & Credly badges yet.
Global Masters badges:







Followers:
Following:
Thanks @Eduard Lebedyuk
Sure will create WRC.