[Info-vax] counting-lock ?
David Jones
JONESD at ecr6.ohio-state.edu
Thu Oct 22 18:07:12 EDT 2009
In message <91916ca0-728c-407a-8a35-eda05350180a at l31g2000vbp.googlegroups.com>,
Pierre <pierre.bru at gmail.com> writes:
>I have a DECnet object which can serve various known queries on a
>database. these queries are resource consuming and I don't want more
>than (say) n=5 of them of the same type to run at the same time. I
>want the other one to be queued up for further processing.
Off the top of my head.
Have 2 DLM resource: A, B.
Acquire:
1. Get EX mode lock on A.
2. Get CR mode lock on B.
3. Use $GETLKI to get GRANTCOUNT on B.
4. If grantcount <= n then
dequeue lock A
return success.
endif
5. convert lock B to PW mode with blocking
AST.
6. Wait for blocking AST or a timeout.
7. if timeout then
dequeue B
dequeue A
return error.
endif
9. convert lock B to CR mode.
10. dequeue lock A
11. return success.
Release:
1. Convert lock B to CW mode. (signals waiter if queued.).
2. Dequeue lock B
-------------------------------------------------------------------------
David L. Jones | Phone: (614) 271-6718
Ohio State University | Internet:
140 W. 19th St. | jonesd at ecr6.ohio-state.edu
Columbus, OH 43210 | vman+ at osu.edu
Disclaimer: I'm looking for marbles all day long.
More information about the Info-vax
mailing list