How should timers be implemented in Rebol? Ports? Otherwise?


#1

With port implementations in R3-Alpha, there would be some amount of the port that was in the core. These would be things like %p-file.c, or %p-net.c. This would be the same for all platforms. Then it would make abstract calls into APIs that were implemented per platform.

One file that's sort of hung around and not been deleted is a bit is the %p-timer.c file. The most substantive thing in the file is a comment block explaining how it might work:

t: open timer://name
write t 10  ; set timer - also allow: 1.23 1:23
wait t
clear t     ; reset or delete?
read t      ; get timer value
t/awake: func [event] [print "timer!"]

(A comment also said "one-shot vs restart timer")

That's pretty much all that's in the file worth keeping. I know earl had written up an implementation for it in Windows somewhere (the host kit side of the equation, e.g. not in %p-timer.c). But I don't think it ever made it to the rebol/rebol GitHub.

It's tempting to work on adding it for real, but it's not a Beta/One priority. Since I'm deleting the file, I wanted to start this thread as a place for any information about timers anyone wants to add.