Global Call API for HMP on Windows Programming Guide — August 2006 29
2
2.Programming Models
This chapter describes the programming models supported by Global Call. Topics include:
Programming Models Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Asynchronous Mode Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.1 Programming Models Overview
The Global Call development 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.
2.2 Asynchronous Mode Programming
Programming in asynchronous mode in Windows is described in the following topics:
Asynchronous Model Overview
Asynchronous Model with Event Handlers
Asynchronous with Windows Callback Model
Asynchronous with Win32 Synchronization Model
Extended Asynchronous Programming Model

2.2.1 Asynchronous Model Overview

Asynchronous mode programming is characterized by the calling thread performing other
processing while a function executes. At completion, the application receives event notification
from the SRL and then the thread continues processing the call on a particular channel.
A function called in the asynchronous mode returns control immediately after the request is passed
to the device driver and allows thread processing to continue. A termination event is returned when
the requested operation completes, thus allowing the Intel Dialogic operation (state machine
processing) to continue.
Caution: In general, when a function is called in asynchronous mode, and an associated termination event
exists, the gc_Close() function should not be called until the termination event has been received.
In order to disable gc_WaitCall(), gc_ResetLineDev( ) should be called. If this is not done, there
are potential race conditions under which the application may crash with a segmentation fault.
Functions may be initiated asynchronously from a single thread and/or the completion
(termination) event can be picked up by the same or a different thread that calls the sr_waitevt()