TipcEventCreateTimer


Name

TipcEventCreateTimer — create a timer event

Synopsis

T_IPC_EVENT TipcEventCreatTimer(dispatcher, interval, event_func, event_arg) 
T_IPC_DISPATCHER dispatcher; 
T_REAL8 interval; 
T_IPC_EVENT_FUNC event_func; 
T_PTR event_arg; 

Arguments

dispatcher — the dispatcher on which to invoke the event

interval — the timer interval

event_func — the function to be invoked

event_arg — an optional argument to pass to the event_func

Return Values

A new event if successful, NULL otherwise.

Diagnostics

If TipcEventCreateTimer fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TipcEventCreateTimer creates a timer event of type T_IPC_EVENT_TIMER to be invoked every interval seconds on the specified dispatcher. If the timer is to be invoked only once, destroy the event in the event_func after the first time it executes.

Caution

None

See Also

TipcEventGetType, TipcEventGetInterval, TipcEventSetInterval

Examples

This example creates a timer event and modifies the event’s interval within the invoked function:

void T_ENTRY timerFunc(T_IPC_EVENT event, T_IPC_EVENT_DATA data, 
                       T_PTR arg) 
{ 
  T_REAL8 interval; 
   
  if (!TipcEventGetInterval(event, &interval)) { 
    return;  /* error */ 
  } 
 
  /* Double the interval */ 
  if (!TipcEventSetInterval(event, interval * 2.0)) { 
    return;  /* error */ 
  } 
} 
 
/* =========================================================== */ 
/*...code from main program is below */ 
 
event = TipcEventCreateTimer(dispatcher, 1.0, timerFunc, T_NULL); 
if (event == NULL) { 
  return;  /* error */ 
} 

TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com