diff -r f0aa341a25bf -r ff2fb7658ff7 imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp --- a/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp Wed Jun 09 10:01:32 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp Mon Jun 21 16:00:46 2010 +0300 @@ -19,12 +19,14 @@ #include #include #include +#include "thumbnaillog.h" #include "thumbnailmanagerconstants.h" LOCAL_C void MainL() { // delay so that cenrep has time to read new config + TN_DEBUG1( "MainL() after" ); User::After(5000000); TInt res( KErrNone ); @@ -32,50 +34,66 @@ TFullName name; // find and terminate Thumb AG Daemon + TN_DEBUG1( "MainL() KTAGDaemonProcess find" ); TFindProcess findProcess( KTAGDaemonProcess ); + if ( findProcess.Next(name) == KErrNone ) { res = process.Open(name); + TN_DEBUG2( "MainL() KTAGDaemonProcess open res = %d", res ); // logon to get termination signal TRequestStatus status; + TN_DEBUG1( "MainL() KTAGDaemonProcess logon" ); process.Logon(status); - + // shutdown using P&S key - RProperty::Set(KTAGDPSNotification,KShutdown,1); - + TN_DEBUG2( "MainL() KTAGDaemonProcess Set = %d", res ); + res = RProperty::Set(KTAGDPSNotification,KShutdown,1); + // blocks here until thread is terminated - User::WaitForRequest(status); + TN_DEBUG1( "MainL() KTAGDaemonProcess wait" ); + User::WaitForRequest(status); // reset key - RProperty::Set(KTAGDPSNotification,KShutdown,0); + TN_DEBUG1( "MainL() KTAGDaemonProcess reset" ); + res = RProperty::Set(KTAGDPSNotification, KShutdown, 0); + TN_DEBUG1( "MainL() KTAGDaemonProcess close" ); process.Close(); } // find and terminate Thumbnail Server TFindProcess findProcess2( KThumbnailServerProcess ); + TN_DEBUG1( "MainL() KThumbnailServerProcess find" ); if ( findProcess2.Next(name) == KErrNone ) { res = process.Open(name); - + TN_DEBUG2( "MainL() KThumbnailServerProcess open res = %d", res ); + // logon to get termination signal TRequestStatus status; + TN_DEBUG1( "MainL() KThumbnailServerProcess logon" ); process.Logon(status); // shutdown using P&S key - RProperty::Set(KTMPSNotification,KShutdown,1); + TN_DEBUG2( "MainL() KThumbnailServerProcess Set res = %d", res ); + res = RProperty::Set(KTMPSNotification,KShutdown,1); // blocks here until thread is terminated - User::WaitForRequest(status); + TN_DEBUG1( "MainL() KThumbnailServerProcess wait" ); + User::WaitForRequest(status); // reset key - RProperty::Set(KTMPSNotification,KShutdown,0); - + TN_DEBUG2( "MainL() KThumbnailServerProcess reset res = %d", res ); + res = RProperty::Set(KTMPSNotification, KShutdown, 0); + + TN_DEBUG1( "MainL() KThumbnailServerProcess close" ); process.Close(); } // delay just in case old daemon hasn't died yet + TN_DEBUG1( "MainL() after" ); User::After(2500000); // start new ThumbAGDaemon @@ -84,29 +102,38 @@ // Create the server process // KNullDesC param causes server's E32Main() to be run + TN_DEBUG2( "MainL() KTAGDaemonExe create res = %d", res ); res = server.Create( KTAGDaemonExe, KNullDesC ); // try again 3 times if fails while ( res != KErrNone) { + TN_DEBUG1( "MainL() KTAGDaemonExe retry" ); if (retryCount > 2) { + TN_DEBUG1( "MainL() KTAGDaemonExe retry > 2" ); return; } + TN_DEBUG1( "MainL() after" ); User::After(2500000); + TN_DEBUG2( "MainL() KTAGDaemonExe create res = %d", res ); res = server.Create( KTAGDaemonExe, KNullDesC ); - retryCount++; } // Process created successfully TRequestStatus status; + TN_DEBUG1( "MainL() Rendezvous" ); server.Rendezvous( status ); + TN_DEBUG1( "MainL() Resume" ); server.Resume(); // start it going + // Wait until the completion of the server creation + TN_DEBUG1( "MainL() wait" ); User::WaitForRequest( status ); + TN_DEBUG1( "MainL() wait done" ); // Server created successfully server.Close(); // we're no longer interested in the other process