beautypg.com

Timer, Atimer = createtimer(nms, afunction), Aninteger = atimer.duration – ClearOne Writing StreamNet User Manual

Page 40: Atimer:cancel()

background image

Writing StreamNet Device Drivers

9-10

All specifications subject to change without notification. All rights reserved. Copyright © 2007 NetStreams

Main +1 512.977-9393 / fax +1 512.977.9398 / Toll Free Technical Support +1 866-353-3496

3600 W. Parmer Lane, Suite 100; Austin, TX 78727 /

www.netstreams.com.

NOTE

Timer

Timers are used to schedule a function to be called at some predetermined time in the
future.

Due to the scheduling
inconsistencies in a
multi-tasking
environment, the only
guarantee that can be
made about when the
timer will be executed is
that it will be executed
no sooner than the time
specified in the
createTimer call. No
real guarantees can be
placed on the maximum
time that will elapse
before the timer is
executed.

NOTE

Timers are not truly
asynchronous events as
they will never interrupt
execution of an
asynchronous stream
handler, command
handler, or another
timer handler.

aTimer = createTimer(nMS, aFunction)

Creates a timer object and schedules it for execution in nMS milliseconds. When the
timer executes it will invoke aFunction with the timer itself as it’s sole parameter. If
the timer function returns a non-zero value, the return value will be used to reschedule
the timer at another future time.

anInteger = aTimer.duration

The duration last specified for the timer, either in createTimer, queue, or as a return
value from timer execution.

aTimer:cancel()

Cancels the timer and prevents any future execution until queue is called.