Path: utzoo!mnetor!uunet!husc6!mailrus!nrl-cmf!ames!amdahl!nsc!voder!blia!ted From: ted@blia.BLI.COM (Ted Marshall) Newsgroups: comp.os.vms Subject: IOSBs on the stack (was Re: 2 C questions) Message-ID: <4500@blia.BLI.COM> Date: 13 Apr 88 17:05:21 GMT References: <281@cullsj.UUCP> <282@cullsj.UUCP> Organization: Britton Lee, Los Gatos, CA Lines: 21 Summary: IOSBs on the stack In article <282@cullsj.UUCP>, jayz@cullsj.UUCP (Jay Zorzy) writes: > Speaking of stacks, here's a common gotcha to watch out for: If you're > issuing any asynchronous $QIOs (no wait, I/O completion handled by AST > routine), make sure to declare your IOSB variables as static. Otherwise, > once the calling routine returns, the stack is reset; an IOSB on the stack > may now point to never-never land. This can bite you even if you use QIOW, IF you have an condition handler which unwinds the stack. This bit me. In our VMS host code, the QIOW read sits waiting for data to come back from the database server. If the user types ^C, The AST routine signals a condition and the handler unwinds the stack before cancelling the QIO (actually this was with our private exception handler instead of the standard VMS condition handler, but it's the same difference). I fixed that by making the IOSBs static. Of course, be careful about making things static if the routine is recusive! -- Ted Marshall ...!ucbvax!mtxinu!blia!ted mtxinu!blia!ted@Berkeley.EDU Britton Lee, Inc., 14600 Winchester Blvd, Los Gatos, Ca 95030 (408)378-7000 The opinions expressed above are those of the poster and not his employer.