ServerStateLifetimeManagement::RegisterShutdownCallback Method

Registers a callback that will be triggered when the Xbox Live Compute platform determines the server instance needs to shutdown.

Syntax

public:
void RegisterShutdownCallback(
         std::function<void(void)> callback
)  

Parameters

callback
Type: std::function<void(void)> 

A callable object with the signature void(void).

Return value

None.

Remarks

RegisterShutdownCallback should be called as soon as possible after calling Startup.

Once a callback is registered with RegisterShutdownCallback, the Xbox Live Compute platform will call the callback if it determines the game server instance needs to shut down. Note that the callback can be triggered at any point after it is registered. If the callback is triggered the server title code should start the shut down process by calling InitiateShutdown.

To ensure that the game will shutdown correctly in all cases, please enclose your InitiateShutdown and Shutdown and the code inside the shutdown callback, in an exception handler. There may be an exception thrown in certain race conditions which can be safely ignored.

Requirements

Header: Declared in ServerStateLifetimeManagement.h.

Library: Use GSDK110.lib (VS 2012) or GSDK100.lib (VS 2010).

See also

ServerStateLifetimeManagement