[Openmcl-devel] Timers

Ron Garret ron at flownet.com
Wed Jun 2 18:43:00 UTC 2021


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