> -----Original Message----- > From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On > Behalf Of Sail Kim > Sent: Tuesday, August 22, 2006 1:25 PM > To: [email protected] > Subject: Re: SETLOCK TEST question please > /snip/ > I didn't want to get the hierarchy violation by obtaining a lower one > while higher one is held which will be abend073. My little test is telling > me that I just can't ask for the CMS lock by testing CMS lock only. > However, many other higher locks are not documented except in the SETLOCK > macro itself. > > What one must do to safely obtain the CMS or higher lock then release it? > > Sail Kim /snip/
IIRC, the hierarchy violation abend only occurs for MODE=UNCOND and the lower lock is currently unavailable. I think for MODE=COND and the lock is immediately available, it will obtain the lock. Otherwise it gives a non-zero return code. Assuming that you've satisfied prerequisite locks, then MODE=COND is probably your best bet for obtaining a SPIN lock that is lower than your currently held SPIN lock. AFAIK, the CPU lock is not part of the SPIN lock hierarchy; it can always be obtained because it just increments a counter. Releasing the CPU lock decrements the counter. Obtaining the CMS lock requires already holding a local lock. It is a SUSPEND lock. Obtaining a SPIN lock MODE=UNCOND requires not holding a higher SPIN lock than the requested SPIN lock. Use MODE=COND to obtain the lock when it is available or give a non-zero return code when unavailable. If it is unavailable, then you'll have to devise some way to retry at a later time, but BE VERY CAREFUL. The lock may be unavailable because another CPU is holding it and trying to obtain the higher lock that your CPU is holding. The whole point of lock hierarchy is to prevent deadly embrace. Hope this helps. Jeffrey D. Smith Principal Product Architect Farsight Systems Corporation 700 KEN PRATT BLVD. #204-159 LONGMONT, CO 80501-6452 303-774-9381 direct 303-484-6170 FAX http://www.farsight-systems.com/ ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

