[gambit-list] Strange Gambit error problems DS

Marc Feeley feeley at iro.umontreal.ca
Thu Oct 26 08:35:40 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 26-Oct-06, at 7:01 AM, Andrew Lentvorski wrote:

> Marc Feeley wrote:
>
>> (##heartbeat-interval-set! 1.0)
>> (##interrupt-vector-set! 1 (lambda () (display "*")))
>> (let loop () (loop))
>
> For some reason, I'm getting a crash if I get a heartbeat interval  
> interrupt before I do that (##interrupt-vector-set! ...).  I have  
> to set the default interval to something absurdly long and then do  
> the (##interrupt-vector-set! ...) in order to avoid a crash.  After  
> that, I can lower the heartbeat interval to a useful value.
>

Before the call (##interrupt-vector-set! 1 ...) the heartbeat  
interrupt will call the thread scheduler.  It is quite possible that  
one of the C functions called by the thread scheduler is incomplete  
or contains a bug, and that's why you get a crash.

You could avoid getting the crash in this case by calling ##interrupt- 
vector-set! before calling ##heartbeat-interval-set! .

>> By the way, contrary to what I said earlier, the heartbeat  
>> interrupts are not necessary for the thread system to work.   
>> However, they are needed for preemptive threads.  You need a  
>> complete implementation of the ___time_get_current_time function  
>> in lib/os_time.c if you want the timed operations to work (thread- 
>> sleep!, timeouts, etc).
>
> Implemented.  Are there any easy ways to to test that time function?
>

Try: (time->seconds (current-time)) .  The value returned is the  
number of seconds since January 1, 1970.

> However, the fact that the time values want to be floats isn't very  
> friendly to the DS as it doesn't have a floating point unit.

The runtime system supports a floating point representation of time  
and a integer representation.  If you want to switch to the integer  
representation (not tested in a while), in lib/os_time.h replace

#define ___FLOAT_TIME_REPRESENTATION

by

#define ___INT_TIME_REPRESENTATION

Marc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFQKud//V9Zc2T/v4RAp5ZAJ9nY9HaRbpkNa1Uh0ZBCh5p3MQR1wCfaCse
x5/kzuGtI6b0AcTNzDBgvkc=
=Dnf1
-----END PGP SIGNATURE-----



More information about the Gambit-list mailing list