Path: utzoo!utgpu!water!watmath!clyde!att!chinet!jkingdon From: jkingdon@chinet.chi.il.us (James Kingdon) Newsgroups: comp.os.vms Subject: Re: Event flags and AST Summary: Use locks instead Message-ID: <6096@chinet.chi.il.us> Date: 26 Jul 88 01:29:47 GMT References: <8807251248.AA15765@ucbvax.berkeley.edu> Reply-To: jkingdon@chinet.chi.il.us (James Kingdon) Organization: Chinet - Public Access Unix Lines: 15 When I had to do this, I just abandoned event flags and used locks as follows: 1. The program that wants to be interrupted later lakes out an exclusive mode lock, with a blocking AST. Then it goes about it's business. 2. When the other program wants to interrupt it, it asks for the lock (also exclusive mode). The first program executes the blocking AST, which does whatever you want to do, and then converts the lock to null, and then converts the lock back to exclusive (this allows the second program to wait for the first one to do something). One thing to be careful of in using locks for this kind of thing is that new lock requests and lock conversions are placed in separate queues. I don't remember whether this might cause a problem in this particular example, but I remember I did think of some scenerio where things could get granted in the wrong order. The fix is simple: When requesting a new lock, request a null mode lock, then convert it to exclusive.