equal
deleted
inserted
replaced
57 MUS_LOG( "mus: [MUSCLI] -> MusManagerServerStarter::Start()" ); |
57 MUS_LOG( "mus: [MUSCLI] -> MusManagerServerStarter::Start()" ); |
58 TFindServer findServer( KMusManagerServerName ); |
58 TFindServer findServer( KMusManagerServerName ); |
59 TFullName name; |
59 TFullName name; |
60 if (findServer.Next(name) == KErrNone) |
60 if (findServer.Next(name) == KErrNone) |
61 { |
61 { |
62 MUS_LOG( "mus: [MUSCLI] <- MusManagerServerStarter::Start()" ); |
62 MUS_LOG( "mus: [MUSCLI] <- MusManagerServerStarter::Start()" ); |
63 return ETrue; // Server already running |
63 |
|
64 // Server may be running but already doing destruction, report |
|
65 // it as not running in such case. |
|
66 RSemaphore closingSemaphore; |
|
67 TBool closingCurrently( |
|
68 closingSemaphore.OpenGlobal( KMusManagerServerClosingSemaphoreName ) == KErrNone ); |
|
69 closingSemaphore.Close(); |
|
70 return !closingCurrently; |
64 } |
71 } |
65 MUS_LOG( "mus: [MUSCLI] <- MusManagerServerStarter::Start()" ); |
72 MUS_LOG( "mus: [MUSCLI] <- MusManagerServerStarter::Start()" ); |
66 return EFalse; |
73 return EFalse; |
67 } |
74 } |
68 |
75 |
71 // ---------------------------------------------------------------------------- |
78 // ---------------------------------------------------------------------------- |
72 // |
79 // |
73 TInt MusManagerServerStarter::CreateServerProcess( RSemaphore& aSemaphore ) |
80 TInt MusManagerServerStarter::CreateServerProcess( RSemaphore& aSemaphore ) |
74 { |
81 { |
75 TInt err = KErrNone; |
82 TInt err = KErrNone; |
|
83 |
|
84 RSemaphore closingSemaphore; |
|
85 if ( closingSemaphore.OpenGlobal( KMusManagerServerClosingSemaphoreName ) == KErrNone ) |
|
86 { |
|
87 MUS_LOG( "mus: [MUSCLI] Server is currently closing, wait" ); |
|
88 // Don't wait forever if server is somehow horribly jammed |
|
89 const TInt KMusServerClosingWaitTimeoutInMicrosecs = 20000000; // 20 secs |
|
90 closingSemaphore.Wait(KMusServerClosingWaitTimeoutInMicrosecs); |
|
91 } |
|
92 closingSemaphore.Close(); |
|
93 |
76 const TUidType serverUid( KNullUid, KNullUid, KServerUid3 ); |
94 const TUidType serverUid( KNullUid, KNullUid, KServerUid3 ); |
77 RProcess server; |
95 RProcess server; |
78 err = server.Create( KMusManagerServerName, KNullDesC() ,serverUid ); |
96 err = server.Create( KMusManagerServerName, KNullDesC() ,serverUid ); |
79 if ( err ) |
97 if ( err ) |
80 { |
98 { |