From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,6d50c88b54316cb9,start X-Google-Attributes: gidf7344,public X-Google-Thread: f7cd1,6d50c88b54316cb9,start X-Google-Attributes: gidf7cd1,public X-Google-Thread: 123a51,6d50c88b54316cb9,start X-Google-Attributes: gid123a51,public X-Google-Thread: 1164f8,6d50c88b54316cb9,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1990-06-20 11:56:57 PST Path: gmdzi!unido!mcsun!uunet!samsung!zaphod.mps.ohio-state.edu!rpi!bu.edu!shelby!mcnc!uvaarpa!murdoch!news From: sdm7g@dale.acc.Virginia.EDU (Steve D. Majewski) Newsgroups: comp.os.vms,uva.vms,comp.sys.dec,vmsnet.misc Subject: VMS(4.5)-CRTL sleep() sometimes doesn't sleep Keywords: sleep $HIBER LIB$WAIT CRTL Message-ID: <1990Jun20.185657.27108@murdoch.acc.Virginia.EDU> Date: 20 Jun 90 18:56:57 GMT Sender: news@murdoch.acc.Virginia.EDU Followup-To: sdm7g@virginia.edu Organization: University of Virginia Xref: gmdzi comp.os.vms:25135 comp.sys.dec:2570 vmsnet.misc:66 Posted: Wed Jun 20 19:56:57 1990 PROBLEM: VMS(4.5)-CRTL routine sleep() sometimes doesn't sleep ! I have made some modifications in a major real-time data acquisition program we have running on a MicroVax II / VMS4.5 written in VMS C. There are 2 "child" processes ( one spawned via vfork()/execl() and the other lib$spawn()-ed : it is in fortran and execl() doesn't seem to pass args properly to non-C ) and 2 DECnet processes, and several connect-to-interrupt drivers. One of the changes was to make what was formerly a DECnet task into one of the local child processes. In the main loop of the main process, it sleeps for n secs while data is accumulating remotely. During this sleep(), the other processes get their work done. I tested most of the pieces seperately, but when I put them all together, sleep didn't sleep and I got a bunch of write errors from writing to a pipe/mailbox. ( I assume this is because without the sleep, the child never has timeslice enough to consume any of the data, and I've run out of I/O buffers to the mailbox. ) I tried replacing the sleep() call with LIB$WAIT() ( with the appropriate floating point pointer arg. ) and the same thing happens. On the theory that something in the code is steping on something - sleep works fine in other code - I stuck in several calls to sleep before the main processing loop : ALL of them work fine, and then sleep() fails when I need it to work. sleep() returns the correct value - not a neg. error return. Also once sleep() fails, LIB$WAIT also fails. Running "show process /cont" in another window, I never see it change state to "HIB" for the sleep calls, but I do see "HIB" when the LIB$WAIT is called - But not long enough, i.e. less than 1 sec. instead of the 45 secs in the LIB$WAIT call. Of course, I could just be missing the change with "show proc" . What could be the cause of this behavior ? I know that sleep() calls SYS$SCHDWK and then SYS$HIBER. The only other cause of a wake up from SYS$HIBER I can find documented is a SYS$WAKE call from another process. This I am not INTENTIONALLY doing - I can't guarantee that it is not the side effect of some other RTL function. What about I/O completion or interrupts ? Any CLues out there ? ------------------------------------------------------------- - Steve Majewski University of Virginia Physiology Dept. (804) 982-0831 sdm7g@virginia.edu