Previous PageTable Of ContentsHomeIndexNext Page

sr_waitevtEx( )

Description | Cautions | Examples | Errors | See Also

Name:

long sr_waitevtEx(handlep, handlecnt, timeout, event_handlep)

Inputs:

long *handlep

  pointer to array of handles to wait for event on

 

int handlecnt

  count of valid handles pointed to by handlep

 

long timeout

  timeout in milliseconds (msec)

 

long *event_handlep

  pointer where to return event handle

Returns:

0 if success

 

-1 if timeout

Includes:

srllib.h

Type:

Event Control function

Top Of PageDescription

The sr_waitevtEx( ) function waits for events on certain devices. This function is an extended version of the standard sr_waitevt( ) function. It is used to asynchronously wait for any event to occur on any of the handles passed to the functions. It detects events from devices opened through any of the device-specific xx_open( ) function calls for that device.

Parameter

Description

handlep

Points to an array of opened handles.

handlecnt

Indicates how many devices are contained in the array.

timeout

A timeout value of -1 instructs sr_waitevt( ) to wait indefinitely for the next event.

Use timeout 0 when the SRL event must return imediately, regardlesss of whether or not an event is present in the SRL event queue.

event_handlep

When an event is reported, an event handle is passed backed to the application through the event_handlep argument. The value returned here should be passed to the sr_getevtdev( ) , sr_getevttype( ) , sr_getevtlen( ), and sr_getevtdatap( ) functions to retrieve the event information.

The sr_waitevtEx( ) function can be used in a single-threaded or multithreaded application. Furthermore, functions initiated asynchronously from one thread can be completed and have the event returned by sr_waitevtEx( ) running in another thread. An application might also have multiple threads blocked in sr_waitevtEx( ) waiting for events on the same device, however it is indeterminate which thread picks up the event, so each thread should be running the same state machine.

Top Of PageCautions

The sr_waitevt( ) and sr_waitevtEx( ) functions should not be used in the same application.

The sr_waitevtEx( ) function can NOT be used in conjunction with handlers.

Top Of PageExample

Top Of PageErrors

If this function returns -1 to indicate failure, obtain the reason for the error by calling the SRL standard attribute function ATDV_LASTERR(SRL_DEVICE) or ATDV_ERRMSGP(SRL_DEVICE) to retrieve either the error code or a pointer to the error description, respectively. One of the following errors may be returned:

ESR_SYS

  • Error from operating system; use dx_fileerrno( ) to obtain error value.

ESR_TMOUT

  • Timed out waiting for event

Top Of PageSee Also


Previous PageTable Of ContentsTop Of PageIndexNext Page

Click here to contact Dialogic Customer Engineering

Copyright 2001, Dialogic Corporation
All rights reserved
This page generated January, 2001