Operating System - OpenVMS
1754278 Members
2744 Online
108813 Solutions
New Discussion юеВ

lib$wait from FORTRAN under VMS 8.2

 
Stephen Goldberg
New Member

lib$wait from FORTRAN under VMS 8.2

We have been using lib$wait with no issues on a VMS 7.2-1 system with the same programs. We recently upgraded to VMS 8.2 and started experiencing problems. The lib$wait follows a call to a sub that uses Oracle RDB. If this routine is commented out the lib$wait works OK. If two lib$waits are used the lib$wait works OK otherwise the lib$wait acts as though the time has expired and drops through with no delay. It is like the lib$wait uses an event flag that is already in use by Oracle RDB. Any thoughts?
6 REPLIES 6
Volker Halle
Honored Contributor

Re: lib$wait from FORTRAN under VMS 8.2

Stephen,

welcome to the OpenVMS ITRC forum.

I've found an Oracle RDB V7 Release note describing this type of problem. See section

5.0.6 Application and Oracle Rdb Both Using SYS$HIBER

in the following document:

http://download-uk.oracle.com/otn_hosted_doc/rdb/pdf/rdbrn_705.pdf

Consider to use the LIB$K_NOWAKE flag to prevent spurious wakes.

Volker.
Hein van den Heuvel
Honored Contributor

Re: lib$wait from FORTRAN under VMS 8.2

Hmmm,

Lib$wait is documented to use SYS$HIBER
SYS$HIBER is documented to 'remember' outstanding wakes: "If one or more wakeup requests are issued for the process while it is not hibernating, the next hibernate call returns immediately; that is, the process does not hibernate. No count of outstanding wakeup requests is maintained."

I'd be tempted to toss in a extra $wake + $hiber before the lib$wait to see of this explains.

The LIB$WAIT documentation suggests to use the LIB$K_NOWAKE flag as second argument preceisely to avoid this unexepected wake problem

hth,
Hein.

David Jones_21
Trusted Contributor

Re: lib$wait from FORTRAN under VMS 8.2

I always code expecting waits, especially sys$hiber(), as a loop with a separate predicate so they are immune to spurious wakes. I think the default behavior of LIB$WAIT was a poor choice, how many people do waits inside an AST routine?
I'm looking for marbles all day long.
John Gillings
Honored Contributor

Re: lib$wait from FORTRAN under VMS 8.2

Stephen,

This is a documented "feature" of LIB$WAIT (at least in its CRTL "sleep" incarnation). The function of LIB$WAIT can be thought of as "WAIT AT MOST" the specified time. A pending $WAKE or $WAKE during the time period will complete the LIB$WAIT prematurely.

I've attached a text file containing a substitute LIB$WAIT routine coded in MACRO32 which implements "WAIT AT LEAST" the specified time. Unlike the LIB$K_NOWAKE solution, my code will work in an AST routine (even though I would stronly recommend against any delays at AST level) or with ASTs disabled.

Note however that it will only work for an F_FLOAT argument. Modifications for other floating point types left as an exercise ;-)
A crucible of informative mistakes
devgoswami
New Member

Re: lib$wait from FORTRAN under VMS 8.2

I feel that the Oracle RDB subroutine which preceeds the LIB$wait call in the in line code may itself have a $ hib call inbuilt call, which causes the process to wake up in advance, before lib$wait takes effect.
If it is essential for u to use the same code structure as is , suggest using Sys$timer call, of the same time duration, as this call cannot be pre empted.
pl use the sys$bintime call to convert the required time to the language of sys$timer.
use a flag for the timer in the region of 32+ to 45, to prevent overlap with any embedded qio calls in the preceeding code section.
( as this flags are not local flags)
Stephen Goldberg
New Member

Re: lib$wait from FORTRAN under VMS 8.2

We have decided to use the lib$k_nowait flag. Thank you for all the help.