Conferencing API Programming Guide — August 2006 13
2
2.Programming Models
This chapter describes the programming models supported by the conferencing software. The
following topics are covered:
•Programming Models Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
•Asynchronous Programming Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1 Programming Models OverviewThe conferencing software supports application development using asynchronous programming
models. By usage, the asynchronous models are often said to use asynchronous mode.
Asynchronous mode programming is introduced briefly in this chapter and described in more detail
in the Standard Runtime Library API Programming Guide.
Note: The conferencing library is implemented as an asynchronous only library. If desired, you can
implement synchronous functionality in the application itself.
2.2 Asynchronous Programming ModelAsynchronous mode programming is characterized by allowing other processing to take place
while a function executes. In asynchronous mode programming, multiple channels are handled in a
single process rather than in separate processes as required in synchronous mode programming.
An asynchronous mode function typically receives an event from the Standard Runtime Library
(SRL) indicating completion (termination) of the function in order for the application to continue
processing a call on a particular channel. A function called in the asynchronous mode returns
control to the application after the request is passed to the device driver. A termination event is
returned when the requested operation completes.
Caution: In general, when a function is called in asynchronous mode, and an associated termination event
exists, the cnf_Close() function should not be called until the termination event has been received.
For Linux environments, the asynchronous models provided for application development include:
Asynchronous (Polled)
In this model, the application polls for or waits for events using the sr_waitevt() function.
When an event is available, event information may be retrieved using SRL event handling
functions such as sr_getevttype(). Retrieved event information is valid until the sr_waitevt( )
function is called again. Typically, the polled model is used for applications that do not need to
use event handlers to process events.
Asynchronous with Event Handlers
This model may be run in non-signal mode only. Event handlers can be enabled or disabled for
specific events on specific devices.