Exiting a program which is waiting on a request
Many a times it happens that a user terminates a program which has actually sent a request for a service. Ideally if an Exit command is fired the pending request should be cancelled and then the program should be terminated. But in some cases the pending request takes a considerable amount of time to be cancelled. For e.g. a Bluetooth discovery request
void CDeviceDiscoverer::DiscoverDevicesL(TDeviceDataList* aDevDataList)
// wipe existing device data list, start fresh
// load protocol for discovery
// initialize host resolver
// start device discovery by invoking remote address lookup
iResolver.GetByAddress(iAddr, iEntry, iStatus);
does not end fast with a call to Cancel().
In such one option is to show a wait note.
Other workaround is to send the application to the background and exit once the request has been canceled or the request is completed.