gc_Stop( )
Termination Events | Cautions | Errors | Example | See Also
Name: int gc_Stop(void) Inputs: Returns: Includes: Category: Mode: Platform and Technology: †See the Global Call Technology User's Guides for additional information.
Description
The gc_Stop( ) function stops call control libraries and releases resources. This function must be the last Global Call function called before exiting the application.
For Linux applications, the gc_Stop( ) function must be called from the parent process when child processes are used.
For multi-threaded applications, the gc_Stop( ) function must be called from the same thread that issued the gc_Start( ) call.
Termination Events
Cautions
- The gc_Stop( ) function must be called before exiting the application.
- All open devices should be closed before issuing a gc_Stop( ) function.
- No Global Call functions should be called after gc_Stop( ). Calling gc_Start( ) a second time after gc_Stop( ) is not recommended although it is allowed in a debug environment. If calling gc_Start( ) after gc_Stop( ) is needed in your application, it should be done only a limited number of times, not frequently.
Errors
If this function returns <0 to indicate failure, use the gc_ErrorInfo( ) function to retrieve the reason for the error. See the "Error Handling" section in the Global Call API Programming Guide. All Global Call error codes are defined in the gcerr.h file. If the error returned is technology specific, see the technology-specific error header file(s) for the error definition (for example, ccerr.h or isdnerr.h file for the ISDN call control library).
Example
#include <stdio.h> #include <srllib.h> #include <stdlib.h> #include <gclib.h> #include <gcerr.h> #define MAXCHAN 30 /* Total Number of channels opened */ LINEDEV port[MAXCHAN + 1]; /* Array of line devices previously opened */ void sysexit( int exit_code ) { int port_num; /* Index used for port[] */ GC_INFO gc_error_info; /* GlobalCall error information data */ /* First close all the handles for the opened boards */ /* Now close all the open GlobalCall devices */ for (port_num = 1; port_num <= MAXCHAN; port_num++ ) { if (gc_Close(port[port_num].ldev) != GC_SUCCESS ) { /* Process error return from gc_Close() */ } } /* Issue gc_Stop() Next */ if (gc_Stop() != GC_SUCCESS ) { /* process error return as shown */ gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_Stop(), GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n", gc_error_info.gcValue, gc_error_info.gcMsg, gc_error_info.ccLibId, gc_error_info.ccLibName, gc_error_info.ccValue, gc_error_info.ccMsg); } /* Close all open file handles corresponding to recorded files and exit */ exit(exit_code); }See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation