×
Namespaces

Variants
Actions

Exiting a program which is waiting on a request

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: rathodavinash (27 Jun 2007)
Last edited: hamishwillee (30 May 2013)

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)
{
 
iDiscoveredDeviceCount=0;
// wipe existing device data list, start fresh
iDevDataList=aDevDataList;
iDevDataList->Reset();
 
// load protocol for discovery
TProtocolDesc pdesc;
User::LeaveIfError(iSocketServ.FindProtocol(KBTLinkManagerTxt(), pdesc));
 
// initialize host resolver
User::LeaveIfError(iResolver.Open(iSocketServ, pdesc.iAddrFamily,
pdesc.iProtocol));
 
// start device discovery by invoking remote address lookup
iAddr.SetIAC(KGIAC);
iAddr.SetAction(KHostResInquiry|KHostResName|KHostResIgnoreCache);
iResolver.GetByAddress(iAddr, iEntry, iStatus);
SetActive();
}

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.

This page was last modified on 30 May 2013, at 07:33.
29 page views in the last 30 days.
×