cnet's Application Programming Interface
- NAME
- CNET_timer_data - recover the data value associated with a running timer
- SYNOPSIS
#include <cnet.h>
CnetTimerID CNET_timer_data(CnetTimerID tid, CnetData *data);
- DESCRIPTION
-
CNET_timer_data()
enables recovery of the CnetData() value associated with the
timer identified by tid.
The data value was originally provided with a call to
CNET_start_timer().
A typical use of CNET_timer_data() is to recover the address of
some dynamically allocated memory (allocated via malloc())
just before calling CNET_stop_timer().
If CNET_timer_data() is not used to recover dynamically allocated
memory in this manner, protocols will have a memory leak.
On success, the saved CnetData value is copied to the address
indicated by data.
- RETURN VALUE
-
The value 0 is returned on success.
On failure, the value -1 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 data is an invalid pointer.
- ER_BADTIMERID
- The value of tid does not represent a currently executing
timer (the timer may have already expired).
- SEE ALSO
-
CNET_start_timer, and
CNET_stop_timer.
|
cnet v3.3.4, written by Chris.McDonald@uwa.edu.au
Last modified: Tue Mar 1 7:43AM 2016