source: FOIAVistA/trunk/r/PCE_PATIENT_CARE_ENCOUNTER-AUTN-EFDP-PX-VSIT--PXRM/PXUALOCK.m@ 1589

Last change on this file since 1589 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.1 KB
Line 
1PXUALOCK ;ISA/KWP - PCE LOCK/UNLOCK UTILITY;3/29/1999
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**67**;AUG 12, 1996
3 ;+ LOCK(PXGLOBAL,PXWAIT,PXATT,PXMSG,PXBKG)
4 ;+ Returns 1 success 0 failure
5 ;+ PXGLOBAL -Global to be locked
6 ;+ PXWAIT -seconds for wait, default of 0
7 ;+ PXATT -Number of attempts to lock before failing
8 ;+ 0 would mean until canceled,default
9 ;+ PXMSG -a message to be printed above the wait message
10 ;+ PXBKG -0 foreground, default
11 ;+ 1 background, if background max 20 attempts
12LOCK(PXGLOBAL,PXWAIT,PXATT,PXMSG,PXBKG) ;
13 I '$G(PXWAIT) S PXWAIT=0
14 I '$G(PXATT) S PXATT=0
15 I '$G(PXBKG) S PXBKG=0
16 N PXTMP,PXSPACE,PXEXIT,PXRESVAL S (PXEXIT,PXRESVAL)=0
17 F PXTMP=1:1:$S(PXATT:PXATT,PXBKG&('PXATT):20,1:9999999) D Q:PXEXIT
18 .L +@PXGLOBAL:PXWAIT
19 .I S (PXRESVAL,PXEXIT)=1 Q
20 .I 'PXBKG D
21 ..I 'PXBKG,PXTMP=1 W:$G(PXMSG)'="" !,PXMSG W !,"Waiting for file access, press ENTER to cancel..."
22 ..R PXSPACE:0
23 ..I S PXEXIT=1 Q
24 ..W "."
25 Q PXRESVAL
26 ;+ UNLOCK (PXGLOBAL,PXMSG)
27 ;+ PXGLOBAL -Global to unlock
28 ;+ PXMSG -message to be printed when unlocked, if any
29UNLOCK(PXGLOBAL,PXMSG) ;
30 L -@PXGLOBAL
31 I $G(PXMSG)'="" W !,PXMSG
32 Q
Note: See TracBrowser for help on using the repository browser.