Article 155893 of comp.os.vms: In article <3249923D.2BDD@nvt.novit.telemax.no>, Hans Jorgen Helgesen writes: :OS: VAX/VMS V5.5, programming language "C". : :Problem: I have two processes communicating with each other via VMS :mailboxes and SYS$QIOW() calls. The sending process first calls :SYS$QIO(..IO$_READVBLK..) to set up an async. read. Then it calls :SYS$QIOW (...IO$_WRITEBLK..) to send a message to the receiving process' :mailbox. When the write-io has completed, the sender waits for the async. :read to complete. : :This works fine almost always, but from time to time (this is a heavy :loaded system), the write-call hangs. This might happen if the receiver :doesn't read the message, BUT IT SURE DOES. Personnal recommendations: o The specification of the IOSB argument is `required' whenever a call `permits' the specification -- assume the IOSB argument is required, not optional. o Confirm that the IOSB storage allocation is made in non-volatile storage, and that the storage will be valid over the life of the asynchronous (sys$qio, etc) call. Be very wary of any IOSB that is declared/allocated from within the stack frame of a routine that might `return' while the sys$qio or other synchronous call -- a call that was issued from in that stack frame or an inner stack frame -- may be (is) still outstanding. o Assume the specification of an explicit (non-zero) event flag is required, whenever a call `permits' same. (The potential for contention on EF0 -- the default EF -- is rather large.) o Use unique (non-zero) event flags across each (and all) asynchronous calls that may be outstanding at any given time. (This technique avoids `spurious' IOSB checks, when another thread happens to set a (shared) event flag.) o synchronize completion via the sys$synch call, or by checking *both* for the event flag *and* for a non-zero IOSB. o Unique event flags can (and should) be allocated via calls to lib$get_ef. -------------------------- pure personal opinion --------------------------- Stephen 'Hoff' Hoffman OpenVMS Engineering hoffman@xdelta.enet.dec.com OpenVMS Frequently Asked Questions (FAQ): http://www.openvms.digital.com