[Openmcl-devel] Timers

Dave Richards dave at synergy.org
Wed Jun 2 12:17:01 PDT 2021


Sorry about that. My laptop was in the process of trying to shut down and I didn’t get a chance to proofread it before I sent it. OK that approach makes sense. It doesn’t take much code to change what I’ve already got. I like it. Thanks!

Sent from my iPhone

On Jun 2, 2021, at 11:43 AM, Ron Garret <ron at flownet.com> wrote:

Your description is a little unclear, but it sounds like you are doing two things:

1.  Setting up a global variable to count in real time and

2.  Polling that variable to trigger a periodic action.

If that’s the case, you don’t need 1 at all, just call (get-internal-real-time).  That is a counter that increments every microsecond.  The rate at which it increments is stored in a global constant internal-time-units-per-second, which on CCL is equal to 1000000.

GET-INTERNAL-REAL-TIME is part of the ANSI spec so should will work in any Common Lisp.

rg

On Jun 2, 2021, at 11:26 AM, dave at synergy.org wrote:

> My code uses timers.  I have a library that implements them.  It expects to
> receive a call periodically, i.e. every 200ms.  On SBCL I hook SIGALRM.  The
> handler simply increments a global variable.  Later on in the main loop the
> variable is swapped in a without-interrupts body and the appropriate number
> of ticks are dispatched.  My code is single-threaded.  How could I implement
> this in CCL?
> 
>    Dave
> 
> 
> 
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel





More information about the Openmcl-devel mailing list