[Simh] idle on VMS and Windows
Bailey, Scott
scott.bailey at eds.com
Wed Jun 11 10:59:02 EDT 2008
Phil,
I see you are running Windows so this may not be applicable to you.
Back in February we had a similar thread ["idle feature"] and I found a
simh bug on at least some Linux platforms. The problem is that the test
for system timer interval (in ms) uses return code 0 as an error
indication. On my Debian system, the timer has nanosecond resolution
(well, it claims to have that resolution!), which is "0 ms (and 1 ns)"
which then gets confused as an error return, so idling got disabled.
I posted a fix -- if querying the timer resolution succeeds but returns
a resolution less than 1 ms, lie and claim a 1 ms resolution. :-)
>I hacked the code at this point [sim_timer.c, line 306] to replace:
>
> return msec;
>
>with
>
> if (msec)
> return msec;
> else
> return 1;
The Windows code (earlier in the same file) is different, but has the
same basic logic and would fail the same way if your host plausibly
returns a minimum time resolution of 0 ms. I have absolutely no idea
what the expected range of return values is.
I suppose it would be better as a general practice to make
sim_os_ms_sleep_init() signed and use -1 as an error return code to
avoid this ambiguity?
Cheers,
-Scott
More information about the Simh
mailing list