Namespaces
Variants
Actions

Exiting a program which is waiting on a request

Jump to: navigation, search
Article Metadata

Article
Created: rathodavinash (27 Jun 2007)
Last edited: hamishwillee (23 Jul 2012)

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 23 July 2012, at 09:48.
73 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved