1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
64 // between the two threads |
64 // between the two threads |
65 switch (iTestNumber) |
65 switch (iTestNumber) |
66 { |
66 { |
67 case KSimTsyTestNumberR5OrR99R4: |
67 case KSimTsyTestNumberR5OrR99R4: |
68 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
68 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
69 iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, TPacketDataConfigBase::KConfigRel5); |
69 iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, RThread().Id(), TPacketDataConfigBase::KConfigRel5); |
70 #else |
70 #else |
71 iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, TPacketDataConfigBase::KConfigRel99Rel4); |
71 iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, RThread().Id(), TPacketDataConfigBase::KConfigRel99Rel4); |
72 #endif |
72 #endif |
73 break; |
73 break; |
74 default: |
74 default: |
75 iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, TPacketDataConfigBase::KConfigGPRS); |
75 iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, RThread().Id(), TPacketDataConfigBase::KConfigGPRS); |
76 break; |
76 break; |
77 } |
77 } |
78 |
78 |
79 // creating and start the thread that will run the active scheduler containing SPUD or SPUDTEL |
79 // creating and start the thread that will run the active scheduler containing SPUD or SPUDTEL |
80 TActiveSchedulerThreadParams params; |
80 TActiveSchedulerThreadParams params; |
81 params.iListener = iListener; |
81 params.iListener = iListener; |
82 params.iThreadId = RThread().Id(); |
|
83 _LIT(activeSchedulerThreadName, "ActiveSchedulerThread_"); |
82 _LIT(activeSchedulerThreadName, "ActiveSchedulerThread_"); |
84 TBuf<255> buf(activeSchedulerThreadName); |
83 TBuf<255> buf(activeSchedulerThreadName); |
85 buf.AppendNum(iTestNumber); |
84 buf.AppendNum(iTestNumber); |
86 TInt ret = iActiveSchedulerThread.Create(buf, ActiveSchedulerThread, KDefaultStackSize, NULL, ¶ms); |
85 TInt ret = iActiveSchedulerThread.Create(buf, ActiveSchedulerThread, KDefaultStackSize, NULL, ¶ms); |
87 TESTEL(ret == KErrNone, ret); |
86 TESTEL(ret == KErrNone, ret); |
101 // if we complete the listener's status with an error, the RunL will stop the |
100 // if we complete the listener's status with an error, the RunL will stop the |
102 // active scheduler and the thread will clean up any resources and exit |
101 // active scheduler and the thread will clean up any resources and exit |
103 TRequestStatus *status = &iListener->iStatus; |
102 TRequestStatus *status = &iListener->iStatus; |
104 iActiveSchedulerThread.RequestComplete(status, KErrCancel); |
103 iActiveSchedulerThread.RequestComplete(status, KErrCancel); |
105 |
104 |
106 // wait until the thread has cleaned up then kill it |
105 // wait until the thread has cleaned up (don't kill the thread, it will die by itself) |
107 // if the iThreadDestructed is never completed, this is probably the result of the UHEAP_MARKEND macro failing |
106 User::WaitForRequest(iListener->iThreadDestructed); |
108 User::WaitForRequest(iListener->iThreadDestructed); |
|
109 iActiveSchedulerThread.Kill(KErrNone); |
|
110 iActiveSchedulerThread.Close(); |
107 iActiveSchedulerThread.Close(); |
111 |
108 |
112 delete iListener; |
109 delete iListener; |
113 iListener = NULL; |
110 iListener = NULL; |
114 |
111 |