Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!mtxinu!rtech!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Machine hangs if serial drivers not closed Message-ID: <7781@hoptoad.uucp> Date: 27 Jun 89 21:03:26 GMT References: <882@hydra.gatech.EDU> <2379@ur-cc.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 38 In article <882@hydra.gatech.EDU> cc100aa@prism.gatech.EDU (Ray Spalding) writes: >I'm developing a terminal emulator. A annoyance is that if my code >crashes, RAMSDClose doesn't get called and the next RAMSDOpen will >hang the machine. From IM-II page 250: "Warning: The RAM Serial Driver >must be closed with a call to RAMSDClose before your application terminates." >Does anyone know any way around this? It sure would speed the development >process. In article <2379@ur-cc.UUCP> mcli@joker.optics.rochester.edu (Maurice Ling) writes: >Could you post the source code that you wrote? Just posting what the >problem is is not enough!!!! Why don't you use the ROM driver? Sure it's enough. The problem is simple and common to all serial driver software -- if the serial driver is open, RAMSDOpen will hang. I have seen the same thing. I believe the way around this is to make a status control call to the driver. If it succeeds, then the driver is open and you better not call RAMSDOpen. If it fails with a bad unit error, then the driver is not now open and you can go ahead and open it. I haven't tried this, but it should work. It probably suffices to check either the input or the output driver for the port you want, but true paranoia would demand checking both. And as for why not to use the ROM driver -- try reading Inside Mac IV-225. You are supposed to always use RAMSDClose and RAMSDOpen now, and have been for about three years. Finally, Maurice, please fix your gol-danged signature! Isn't it long enough without seven lines of extra repeated crud at the end? How many times do we have to see this thing? -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com Postal: 424 Tehama, SF CA 94103; Phone: (415) 495-2934 "Jesus died for somebody's sins, but not mine." -- Patti Smith