dorner@pequod.cso.uiuc.edu (Steve Dorner) (11/03/90)
I've just spent two days beating my head against a wall. Either I'm missing something (a distinct possibility) or the "Apple Modem Tool" does not support calling CMClose asynchronously. Here's my close routine: /************************************************************************ * MyCMClose - call CMClose ************************************************************************/ short MyCMClose(ConnHandle cn) { AsyncStuff stuff; short err; /* real error */ short repErr; /* error to be reported to user */ (*cn)->refCon = (long) &stuff; /* store address */ stuff.pending = 1; if (BUG1) { if (!(repErr=err=CMClose(cn,True,CTBComplete,-1,True))) { SpinOn(&stuff.pending); if (CommandPeriod) { err = cmTimeOut; repErr = noErr; } } } else repErr=err=CMClose(cn,False,nil,-1,True); if (repErr) CTBTrouble(repErr); return (err); /* error? */ } If BUG1 is non-zero, the connection will not be closed properly, and the next time I try to open a connection, I will be told that the "selected port is in use". SpinOn spins (politely) until a flag is cleared; CTBComplete clears the flag. SpinOn does call CMIdle (this seems to be required for async opens). SpinOn will set the global CommandPeriod if the user types cmd-. (I'm not, FYI.) I use exactly the same strategy for CMOpen, CMRead, and CMWrite, with no problems. It's only CMClose that's obnoxious. Am I doing something wrong, or is this indeed a bug? (CTB 1.0, SE/30, 8MB, 6.0.5, MPW C 3.1, few INIT's, if any of that matters.) The "Serial Tool" doesn't exhibit the behavior. -- Steve Dorner, U of Illinois Computing Services Office Internet: s-dorner@uiuc.edu UUCP: uunet!uiucuxc!uiuc.edu!s-dorner