NAME
application_shutdown
- Notifies the application that the server shutdown is underway.
SYNOPSIS
#include <game-carrier/server.h>
GC_ADAPTER_EVENT
void application_shutdown(
GCT_INT app_id);
Parameters:
app_id
GCT_INT
Unique identifier of the application.
RETURN VALUE
None.
DESCRIPTION
The application_shutdown
function is used to notify the application that the
server shutdown process is underway. At this stage, all network operations
through the Game Carrier Server become inaccessible to the application.
The application_shutdown
function is invoked by the gcs
for each
application specified in the server’s configuration file.
This method provides a convenient way to deallocate all application resources. Upon completion of this method, the server will exit shortly.
The app_id
parameter represents the unique identifier of the application. This
value is also used when the application_initialize
is called.
EXAMPLE
#include <game-carrier/server.h>
#include <stdlib.h>
#include <string.h>
struct core_api api;
int adapter_id = -1;
char * adapter_load_path;
GC_ADAPTER_EVENT
GCT_INT adapter_initialize(
GCT_INT id,
struct core_api * core_api,
GCT_CPTR load_path)
{
api = *core_api;
adapter_id = id;
adapter_load_path = strdup(load_path);
/* Here is good place to initialize/allocate global adapter's resources */
return 0;
}
GC_ADAPTER_EVENT
void adapter_finalize(GCT_INT id)
{
/* Here is good place to deinitialize/free lobal adapter's resources */
free(adapter_load_path);
}
SEE ALSO
application_stop
, application_finalize
, application_initialize