Increments the lock count for a MUMPS global. Note that MUMPS locks are advisory, meaning that MUMPS will not enforce locking automatically. It is the responsibility of your application code to check for and honor any outstanding locks before setting a MUMPS global.
Argument | Data Type | Required | Default | Description |
---|
globalName | string | Yes | - | The name of the global to |
examinelock |
subscripts | array | Yes | - | An array of subscripts |
timeout | numeric | No | 0 | Number of seconds after which the lock attempt will fail |
mumps.lock() returns true if the lock was successfully acquired.
Code Block |
---|
language | js |
---|
title | CFScript |
---|
linenumbers | true |
---|
|
var mumps = new lib.cfmumps.Mumps();
mumps.open();
if(mumps.lock("patients", ["WILLIS", "JOHN", "DOB"])) {
mumps.set("patients", ["WILLIS", "JOHN", "DOB"], "12/1/1980");
mumps.unlock("patients", ["WILLIS", "JOHN", "DOB"]);
}
else {
writeOutput("<p>Lock failed.</p>");
}
mumps.close(); |
Code Block |
---|
language | coldfusion |
---|
title | CFML |
---|
linenumbers | true |
---|
|
<cfset mumps = new lib.cfmumps.Mumps()>
<cfset mumps.open()>
<!--- lock ^patients("WILLIS, JOHN","DOB") --->
<cfif mumps.lock("patients", ["WILLIS, JOHN", "DOB"])>
<cfset mumps.set("patients", ["WILLIS, JOHN", "DOB"], "12/1/1980")>
<cfset mumps.unlock("patients", ["WILLIS, JOHN", "DOB"])>
<cfelse>
<p>Lock failed.</p>
</cfif>
<cfset mumps.close()> |