[gambit-list] Strange Gambit error problems DS
Marc Feeley
feeley at iro.umontreal.ca
Wed Oct 25 07:33:08 EDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 25-Oct-06, at 4:48 AM, Andrew Lentvorski wrote:
> Marc Feeley wrote:
>
>> For the threading system to work, you will need a heartbeat
>> interrupt (complete the implementation of
>> setup_heartbeat_interrupt_handling and friends in lib/os_time.c)
>
> I've been trying to model my heartbeat code after the
> USE_dos_setvect_1Ch code. However, I have two questions:
>
> 1) How do I notify Gambit that a heartbeat has fired?
>
> I looked at the dos_setvect stuff, but I don't see anything which
> does the actual notifcation. I don't have signals available that I
> know of, so that's out. Presumably I need to set a semaphore
> somewhere and Gambit will eventually see that a heartbeat has
> fired, but where?
You have to call ___time_mod.heartbeat_interrupt_handler() . This
function is set when ___setup_time_module(heartbeat_intr) is called
in lib/os.c . The function heartbeat_intr calls ___raise_interrupt
(___INTR_HEARTBEAT) which raises a flag that is detected by the
Scheme code through polling (see my paper "Polling efficiently on
stock hardware", http://www.iro.umontreal.ca/~feeley/papers/
polling.ps.gz).
>
> 2) How do I test that I have the heartbeat system working?
>
> Thanks,
> -a
(##heartbeat-interval-set! 1.0)
(##interrupt-vector-set! 1 (lambda () (display "*")))
(let loop () (loop))
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).
Marc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)
iD8DBQFFP0t1//V9Zc2T/v4RAgz4AKCdUsk4SAHxnqnVb2lXoA+KrIAYZQCgsgaa
U25WOjOb4dVKu6TqMFZ/B10=
=qm9t
-----END PGP SIGNATURE-----
More information about the Gambit-list
mailing list