cnet v4.0.4  

home topology files command‑line options the core API FAQ download and install

cnet's Application Programming Interface

NAME
CNET_start_timer - start the asynchronous execution of a new timer

SYNOPSIS
#include <cnet.h> CnetTimerID CNET_start_timer(CnetEvent ev, CnetTime usec, CnetData data);

DESCRIPTION
CNET_start_timer requests that a new timer be created which will expire in the indicated number of microseconds.

A unique timer identifier is returned to distinguish this newly started timer from all others.

When this timer expires (after usecs have elapsed), the event handler of the indicated timer event, EV_TIMER0..EV_TIMER9, will be called. The parameters passed to the event handler will be ev, the unique timer identifier, and the value of data.

If data refers to dynamically allocated memory (allocated via malloc), then the timer's handler should deallocate this memory, else protocols will have a memory leak. Similarly, if CNET_stop_timer is required to prematurely stop a running timer, CNET_timer_data should first be used to recover the value of data.

RETURN VALUE
A unique timer identifier of type CnetTimerID is returned on success. On failure, the value NULLTIMER is returned, and the global variable cnet_errno is set to one of the following values to describe the error:

ER_BADARG
The value of usec is less than or equal to 0.
ER_BADEVENT
The value of ev is not one of EV_TIMER0..EV_TIMER9.
SEE ALSO
CNET_stop_timer, and CNET_timer_data.

cnet v4.0.4 - [email protected]