diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-508DD478-1876-5DE2-9271-BDD99F51F579.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-508DD478-1876-5DE2-9271-BDD99F51F579.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,72 @@ + + + + + +How +to use a change notifierProvides code snippets to show you how to use a change notifier. +

To use a change notifier, a thread:

+ +

When a change occurs, the change information is made available to the thread +through the TRequestStatus object and the thread's request +semaphore is signalled to indicate that the request is complete.

+

The following code fragments demonstrates this:

+{ +... +RChangeNotifier the_notifier; +TRequestStatus the_status; +... +the_notifier.Create(); +the_notifier.Logon(the_status); +User::WaitForRequest(the_status); +... +...// prepare for a long wait +... +TInt changes = the_status.Int(); +if (changes & EChangesSystemTime) + { + // handle a change to system time + } +if (changes & EChanges EChangesLocale) + { + // handle a change to locale + } +... +the_notifier.Close(); +... +} +

In practical code, an RChangeNotifier would be part of +an active object.

+

The RChangeNotifier handle also offers the LogonCancel() function. +Calling this function, causes the thread's request semaphore to +be signalled and any wait to complete. The TRequestStatus is +set to KErrCancel.

+

The above technique for checking changes is used because, at the completion +of a notification request, any, or all, changes may be reported. Code should +make no assumptions about the other bits in the returned value. In other words, +code should be prepared for a notification request to complete without an +'interesting' change.

+

Users should also note that the first notification request after creation +of an RChangeNotifier, completes immediately; the +changes reported are all those defined by the TChanges enum.

+

Also note that after a notification request completes, other changes may +occur before the user of the RChangeNotifier can issue the +next notification request. If this occurs, any change events are collected +by the change notifier; they are not lost; in this situation, the next notification +request completes immediately.

+
\ No newline at end of file