landmarks/locationlandmarks/tsrc/LandmarkTestModule/src/FT_CPosTp106.cpp
branchRCL_3
changeset 44 2b4ea9893b66
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *   ?description_line
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDES
       
    21 #include <e32std.h>
       
    22 #include <ss_std.h>
       
    23 
       
    24 #include <EPos_CPosLandmarkDatabase.h> 
       
    25 #include <EPos_CPosLandmark.h> 
       
    26 #include <EPos_CPosLmDatabaseManager.h>
       
    27 
       
    28 #include "FT_CPosTp106.h"
       
    29 
       
    30 // Nr of simultaneous clients (threads)
       
    31 const TInt KNoMultipleClients = 5;
       
    32 
       
    33 // Nr of created dbs
       
    34 const TInt KNrOfDBs=25;
       
    35 const TInt KCheckIfExistDBs=10;
       
    36 
       
    37 // ================= MEMBER FUNCTIONS =======================
       
    38 
       
    39 // ---------------------------------------------------------
       
    40 // CPosTp106::CloseTest
       
    41 //
       
    42 // (other items were commented in a header).
       
    43 // ---------------------------------------------------------
       
    44 //
       
    45 void CPosTp106::CloseTest()
       
    46     {
       
    47     iLog->Log(_L("CloseTest"));
       
    48     for (TInt i=0; i<iThreads.Count(); i++)
       
    49         {
       
    50         iThreads[i].Close();
       
    51         }
       
    52 
       
    53     iThreads.Close();
       
    54 
       
    55     delete iDatabase;
       
    56     iDatabase=NULL;
       
    57 
       
    58     iUseLogFromThreadIsDisabled = EFalse;
       
    59     
       
    60     TRAPD(err, RemoveAllLmDatabasesL());
       
    61     if (err != KErrNone) iLog->Log(_L("Error when deleting all lm dbs"));
       
    62 
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------
       
    66 // CPosTp106::StartL
       
    67 //
       
    68 // (other items were commented in a header).
       
    69 // ---------------------------------------------------------
       
    70 //
       
    71 void CPosTp106::StartL()
       
    72     {
       
    73     MakeSurePanicDebugFileExistsL();
       
    74            
       
    75     RemoveAllLmDatabasesL();
       
    76     
       
    77     iUseLogFromThreadIsDisabled = ETrue;
       
    78 	
       
    79 	TBuf<150> buf;
       
    80 	
       
    81 	_LIT(KTrace1, "Create %d x %d (=%d) nr of dbs took = %d msec");
       
    82 	_LIT(KTrace2, "Copy %d x %d (=%d) nr of dbs took = %d msec");
       
    83 	_LIT(KTrace3, "Get and Set default URI for %d x %d (=%d) nr of dbs took = %d msec");
       
    84 	_LIT(KTrace4, "Get display name for %d x %d (=%d) nr of dbs took = %d msec");
       
    85 	_LIT(KTrace5, "Check if db exist for %d x %d (=%d) nr of dbs took = %d msec");
       
    86 	_LIT(KTrace6, "Delete %d x %d (=%d) nr of dbs took = %d msec");
       
    87 	
       
    88     iTestStep=Step1;
       
    89     StartMultipleClientsL(KNoMultipleClients);
       
    90     TInt64 msec = (iStop.Int64() - iStart.Int64())/1000;
       
    91    	buf.Format(KTrace1, KNrOfDBs, KNoMultipleClients, KNrOfDBs*KNoMultipleClients, msec);
       
    92     iLog->Log(buf);
       
    93     
       
    94     iTestStep=Step2;
       
    95     StartMultipleClientsL(KNoMultipleClients);
       
    96     msec = (iStop.Int64() - iStart.Int64())/1000;
       
    97    	buf.Format(KTrace2, KNrOfDBs, KNoMultipleClients, KNrOfDBs*KNoMultipleClients, msec);
       
    98     iLog->Log(buf);
       
    99     
       
   100     iTestStep=Step3;
       
   101     StartMultipleClientsL(KNoMultipleClients);
       
   102     msec = (iStop.Int64() - iStart.Int64())/1000;
       
   103    	buf.Format(KTrace3, KNrOfDBs, KNoMultipleClients, KNrOfDBs*KNoMultipleClients, msec);
       
   104     iLog->Log(buf);
       
   105     
       
   106     iTestStep=Step4;
       
   107     StartMultipleClientsL(KNoMultipleClients);
       
   108     msec = (iStop.Int64() - iStart.Int64())/1000;
       
   109    	buf.Format(KTrace4, KNrOfDBs, KNoMultipleClients, KNrOfDBs*KNoMultipleClients, msec);
       
   110     iLog->Log(buf);
       
   111     
       
   112     iTestStep=Step5;
       
   113     StartMultipleClientsL(KNoMultipleClients);
       
   114     msec = (iStop.Int64() - iStart.Int64())/1000;
       
   115    	buf.Format(KTrace5, KNrOfDBs, KNoMultipleClients, KNrOfDBs*KNoMultipleClients, msec);
       
   116     iLog->Log(buf);
       
   117    
       
   118     iTestStep=Step6;
       
   119     StartMultipleClientsL(KNoMultipleClients);
       
   120     msec = (iStop.Int64() - iStart.Int64())/1000;
       
   121    	buf.Format(KTrace6, KNrOfDBs, KNoMultipleClients, KNrOfDBs*KNoMultipleClients, msec);
       
   122     iLog->Log(buf);                
       
   123     
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------
       
   127 // CPosTp106::StartMultipleClientsL
       
   128 //
       
   129 // (other items were commented in a header).
       
   130 // ---------------------------------------------------------
       
   131 //
       
   132 void CPosTp106::StartMultipleClientsL(const TUint aNoClients)
       
   133     {
       
   134     _LIT(KMultipleErr, "Error %d from thread %d");
       
   135     _LIT(KPanicErr, "Thread %d has panicked or is alive");
       
   136     _LIT(KSuccess, "Thread %d is successful");
       
   137       
       
   138     CreateThreadsL(aNoClients);
       
   139 
       
   140     RArray<TRequestStatus> statuses;
       
   141     CleanupClosePushL(statuses);
       
   142    	
       
   143    	// Start measuring time
       
   144    	iStart.UniversalTime();
       
   145    	
       
   146     for (TUint j=0; j<aNoClients; j++)
       
   147         {
       
   148         TRequestStatus status;
       
   149         statuses.Append(status);
       
   150         }
       
   151 
       
   152     TInt i=0; 
       
   153     for (i=0; i<iThreads.Count(); i++)
       
   154         { 
       
   155         iThreads[i].Logon(statuses[i]);
       
   156         iThreads[i].Resume();
       
   157         }
       
   158     
       
   159     for (i=0; i<iThreads.Count(); i++)
       
   160         {
       
   161         User::WaitForRequest(statuses[i]);
       
   162         }
       
   163     
       
   164     TInt errors=0; 
       
   165     for (i=0; i<iThreads.Count(); i++)
       
   166         {
       
   167         TInt exitReason = iThreads[i].ExitReason();
       
   168         TBuf<100> info;
       
   169             
       
   170         if (exitReason != KErrNone)
       
   171             {
       
   172             errors++;
       
   173             info.Format(KMultipleErr, exitReason, i+1);
       
   174             }  
       
   175          else
       
   176             {
       
   177             info.Format(KSuccess, i+1);
       
   178             }
       
   179         iLog->Log(info);
       
   180 
       
   181         AssertTrueSecL(iThreads[i].ExitType() == EExitKill, KPanicErr, i+1);
       
   182         AssertTrueSecL(exitReason == KErrNone || exitReason == KErrLocked, info);
       
   183         }
       
   184         
       
   185     // Stop measuring time
       
   186 	iStop.UniversalTime();
       
   187 /*        
       
   188     if (iTestStep != EReadLockTaken)
       
   189         {
       
   190         AssertTrueSecL(errors == KNoMultipleClients - 1, KAllErr);        
       
   191         }
       
   192     else
       
   193         {
       
   194         // All imports should have failed since the started search should have taken a read lock
       
   195         AssertTrueSecL(errors == KNoMultipleClients, KAllNotFailedErr);        
       
   196         }
       
   197        */
       
   198     
       
   199     for (i=0; i<iThreads.Count(); i++)
       
   200         {
       
   201         iThreads[i].Close();
       
   202         }
       
   203     
       
   204     iThreadIndex=0;
       
   205     iThreads.Close();
       
   206     CleanupStack::PopAndDestroy(&statuses);
       
   207     }
       
   208 
       
   209 // ---------------------------------------------------------
       
   210 // CPosTp106::RunTestL
       
   211 //
       
   212 // (other items were commented in a header).
       
   213 // ---------------------------------------------------------
       
   214 //
       
   215 void CPosTp106::RunTestL(TAny* aData)
       
   216     {
       
   217     CPosTp106* self = reinterpret_cast<CPosTp106*>(aData);
       
   218     TInt index = ++self->iThreadIndex;
       
   219    
       
   220    	TBuf<100> info;
       
   221     _LIT(KInfo2, "Thread %d before execute");
       
   222     info.Format(KInfo2, index);
       
   223     RDebug::Print(info);
       
   224 
       
   225     switch (self->iTestStep)
       
   226         {
       
   227         case Step1:
       
   228         	self->CreateAndListDatabasesL(index);
       
   229         break;
       
   230         case Step2:
       
   231         	self->CopyDatabasesL(index);
       
   232         break;
       
   233         case Step3:
       
   234         	self->SetAndGetUriL(index);
       
   235         break;
       
   236         case Step4:
       
   237         	self->GetDisplayNameL();
       
   238         break;
       
   239         case Step5:
       
   240         	self->CheckIfExistL(index);
       
   241         break;
       
   242         case Step6:
       
   243         	self->DeleteDatabasesL();
       
   244         break;                
       
   245         }
       
   246     
       
   247     _LIT(KInfo3, "Thread %d after execute");
       
   248     info.Format(KInfo3, index);
       
   249     RDebug::Print(info);
       
   250     }
       
   251 
       
   252 // ---------------------------------------------------------
       
   253 // CPosTp106::CreateAndListDatabasesL
       
   254 //
       
   255 // (other items were commented in a header).
       
   256 // ---------------------------------------------------------
       
   257 //
       
   258 void CPosTp106::CreateAndListDatabasesL(TInt index)
       
   259     {
       
   260     CPosLmDatabaseManager* manager = CPosLmDatabaseManager::NewL();
       
   261     CleanupStack::PushL(manager);
       
   262 
       
   263     _LIT(KLmName, "Thread_%d_LmDbIndex%d.ldb");
       
   264     _LIT(KLmURI, "file://C:Thread_%d_LmDbIndex%d.ldb");
       
   265     TBuf<50> lmDbName;
       
   266     TBuf<50> lmDbUri;
       
   267     TInt i=0;
       
   268     TInt NrOfFoundDbs=0;
       
   269     // Create KNrOfDBs nr of  landmark dbs
       
   270     
       
   271     HPosLmDatabaseInfo* dbInfo = NULL;
       
   272     for (i=0;i<KNrOfDBs;i++)
       
   273     	{
       
   274     	lmDbName.Zero();
       
   275     	lmDbName.Format(KLmName, index, i);
       
   276     	dbInfo = HPosLmDatabaseInfo::NewLC(lmDbName);
       
   277     	manager->CreateDatabaseL(*dbInfo);
       
   278     	CleanupStack::PopAndDestroy(dbInfo);
       
   279     	/*
       
   280     	This increases the filesize to much
       
   281     	CPosLandmarkDatabase* db = CPosLandmarkDatabase::OpenL(lmDbName);
       
   282     	CleanupStack::PushL(db);
       
   283     	
       
   284     	if (db->IsInitializingNeeded())
       
   285         	{
       
   286         	ExecuteAndDeleteLD(db->InitializeL());
       
   287         	}
       
   288     	CleanupStack::PopAndDestroy(db);
       
   289     	*/
       
   290     	}
       
   291     
       
   292     // List all dbs    
       
   293     CDesCArray* dbArray = manager->ListDatabasesLC();
       
   294     TInt nr = dbArray->Count();
       
   295 	
       
   296 	// Check that at least KNrOfDBs nr of dbs exist
       
   297 	if (nr < KNrOfDBs) User::Panic(_L("Wrong Nr"), -666);
       
   298 	
       
   299 	// Check that all created dbs are listed
       
   300 	for (TInt j=0;j<KNrOfDBs;j++)
       
   301 		{
       
   302 		lmDbUri.Zero();
       
   303 		lmDbUri.Format(KLmURI, index, j);
       
   304 		for (i=0;i<nr;i++)
       
   305 			{
       
   306 			if ((*dbArray)[i].CompareC(lmDbUri) == KErrNone)
       
   307 				{
       
   308 				// Found
       
   309 				i=nr;
       
   310 				NrOfFoundDbs++;
       
   311 				}
       
   312 			}
       
   313 		}
       
   314     
       
   315     if (NrOfFoundDbs != KNrOfDBs) User::Panic(_L("Wrong Nr"), -667);
       
   316     
       
   317     CleanupStack::PopAndDestroy(dbArray);
       
   318     CleanupStack::PopAndDestroy(manager);
       
   319     }
       
   320     
       
   321 // ---------------------------------------------------------
       
   322 // CPosTp106::CopyDatabasesL
       
   323 //
       
   324 // (other items were commented in a header).
       
   325 // ---------------------------------------------------------
       
   326 //
       
   327 void CPosTp106::CopyDatabasesL(TInt index)
       
   328     {
       
   329     CPosLmDatabaseManager* manager = CPosLmDatabaseManager::NewL();
       
   330     CleanupStack::PushL(manager);
       
   331 
       
   332     _LIT(KLmName, "Thread_%d_LmDbIndex%d.ldb");
       
   333     _LIT(KLmNameCopy, "Thread_%d_LmDbIndex%d_Copy.ldb");
       
   334     _LIT(KLmURICopy, "file://C:Thread_%d_LmDbIndex%d_Copy.ldb");
       
   335     TBuf<50> lmDbName;
       
   336     TBuf<50> lmDbNameCopy;
       
   337     TBuf<50> lmDbUriCopy;
       
   338     TInt i=0;
       
   339     TInt NrOfFoundDbs=0;
       
   340     // Create KNrOfDBs nr of  landmark dbs
       
   341     for (i=0;i<KNrOfDBs;i++)
       
   342     	{
       
   343     	lmDbName.Zero();
       
   344     	lmDbName.Format(KLmName, index, i);
       
   345     	
       
   346     	lmDbNameCopy.Zero();
       
   347     	lmDbNameCopy.Format(KLmNameCopy, index, i);
       
   348     	manager->CopyDatabaseL(lmDbName, lmDbNameCopy);
       
   349     	}
       
   350     
       
   351     // List all dbs
       
   352     CDesCArray* dbArray = manager->ListDatabasesLC();
       
   353     TInt nr = dbArray->Count();
       
   354 	
       
   355 	// Check that at least all copied dbs are listed
       
   356 	for (TInt j=0;j<KNrOfDBs;j++)
       
   357 		{
       
   358 		lmDbUriCopy.Zero();
       
   359 		lmDbUriCopy.Format(KLmURICopy, index, j);
       
   360 		for (i=0;i<nr;i++)
       
   361 			{
       
   362 			if ((*dbArray)[i].Compare(lmDbUriCopy) == KErrNone)
       
   363 				{
       
   364 				// Found
       
   365 				i=nr;
       
   366 				NrOfFoundDbs++;
       
   367 				}
       
   368 			}
       
   369 		}
       
   370     
       
   371     if (NrOfFoundDbs != KNrOfDBs) User::Panic(_L("WrongNrOfCopiedDb"), -667);
       
   372     
       
   373     CleanupStack::PopAndDestroy(dbArray);
       
   374     CleanupStack::PopAndDestroy(manager);
       
   375     }
       
   376      
       
   377 // ---------------------------------------------------------
       
   378 // CPosTp106::DeleteDatabasesL
       
   379 //
       
   380 // (other items were commented in a header).
       
   381 // ---------------------------------------------------------
       
   382 //
       
   383 void CPosTp106::DeleteDatabasesL()
       
   384     {
       
   385     CPosLmDatabaseManager* manager = CPosLmDatabaseManager::NewL();
       
   386     CleanupStack::PushL(manager);
       
   387 
       
   388     // _LIT(KLmURICopy, "file://C:Thread_%d_LmDbIndex%d_Copy.LDB");
       
   389     // _LIT(KLmURI, "file://C:THREAD_%d_LMDBINDEX%d.LDB");
       
   390     
       
   391     TBuf<50> lmDbUri;
       
   392     TBuf<50> lmDbUriCopy;
       
   393 	
       
   394 	CDesCArray* dbArray = manager->ListDatabasesLC();
       
   395     TInt nr = dbArray->Count();
       
   396     
       
   397     // Delete all created dbs and copied dbs
       
   398 	for (TInt j=0;j<nr;j++)
       
   399 		{
       
   400 		TRAPD(err, manager->DeleteDatabaseL((*dbArray)[j]));
       
   401 		}
       
   402     
       
   403     /*
       
   404 	// Delete all created dbs and copied dbs
       
   405 	for (TInt j=0;j<KNrOfDBs;j++)
       
   406 		{
       
   407 		lmDbUriCopy.Zero();
       
   408 		lmDbUri.Zero();
       
   409 		lmDbUriCopy.Format(KLmURICopy, index, j);
       
   410 		lmDbUri.Format(KLmURI, index, j);
       
   411 		
       
   412 		manager->DeleteDatabaseL(lmDbUriCopy);
       
   413 		manager->DeleteDatabaseL(lmDbUri);
       
   414 		}
       
   415 		*/
       
   416     
       
   417     CleanupStack::PopAndDestroy(dbArray);
       
   418     CleanupStack::PopAndDestroy(manager);
       
   419     }
       
   420 
       
   421 // ---------------------------------------------------------
       
   422 // CPosTp106::SetAndGetUriL
       
   423 //
       
   424 // (other items were commented in a header).
       
   425 // ---------------------------------------------------------
       
   426 //
       
   427 void CPosTp106::SetAndGetUriL(TInt /*index*/)
       
   428     {
       
   429     CPosLmDatabaseManager* manager = CPosLmDatabaseManager::NewL();
       
   430     CleanupStack::PushL(manager);
       
   431 
       
   432     _LIT(KLmURI, "file://C:Thread_%d_LmDbIndex%d.ldb");
       
   433     
       
   434     // Try to set (and get) defaultdb to dbs created by first thread
       
   435     TBuf<50> name;
       
   436 
       
   437 	// index = 0;
       
   438 	for (TInt j=0;j<KNrOfDBs;j++)
       
   439 		{
       
   440 		name.Zero();
       
   441 		// Use first thread index 1
       
   442 		name.Format(KLmURI, 1, j);
       
   443 		manager->SetDefaultDatabaseUriL(name);
       
   444 		
       
   445 		HBufC* defaultName = manager->DefaultDatabaseUriLC();
       
   446 		
       
   447 		// TBD Maybe some other client has succeeded in changing the default name already
       
   448 		if (defaultName->Compare(name) != KErrNone)
       
   449 			{
       
   450 			User::Panic(_L("WrongDefaultDb"), -671);
       
   451 			}
       
   452 		CleanupStack::PopAndDestroy(defaultName);	
       
   453 		}
       
   454     CleanupStack::PopAndDestroy(manager);
       
   455     }
       
   456 
       
   457 // ---------------------------------------------------------
       
   458 // CPosTp106::GetDisplayNameL
       
   459 //
       
   460 // (other items were commented in a header).
       
   461 // ---------------------------------------------------------
       
   462 //
       
   463 void CPosTp106::GetDisplayNameL()
       
   464     {
       
   465     CPosLmDatabaseManager* manager = CPosLmDatabaseManager::NewL();
       
   466     CleanupStack::PushL(manager);
       
   467 		
       
   468 	// Get display name for default db
       
   469 	for (TInt j=0;j<KNrOfDBs;j++)
       
   470 		{	
       
   471 		HBufC* dbUri = manager->DefaultDatabaseUriLC();
       
   472 		HPosLmDatabaseInfo* dbInfo = HPosLmDatabaseInfo::NewLC(dbUri->Des());
       
   473 		TPosLmDatabaseSettings settings = dbInfo->Settings();
       
   474 		TPtrC displayName = settings.DatabaseName();
       
   475 		CleanupStack::PopAndDestroy(2);
       
   476 		}
       
   477 		
       
   478 	CleanupStack::PopAndDestroy(manager);
       
   479     }
       
   480 
       
   481 // ---------------------------------------------------------
       
   482 // CPosTp106::CheckIfExistL
       
   483 //
       
   484 // (other items were commented in a header).
       
   485 // ---------------------------------------------------------
       
   486 //
       
   487 void CPosTp106::CheckIfExistL(TInt index)
       
   488     {
       
   489     CPosLmDatabaseManager* manager = CPosLmDatabaseManager::NewL();
       
   490     CleanupStack::PushL(manager);
       
   491 
       
   492     _LIT(KLmURICopy, "file://C:Thread_%d_LmDbIndex%d_Copy.ldb");
       
   493     _LIT(KLmURI, "file://C:Thread_%d_LmDbIndex%d.ldb");
       
   494     
       
   495     _LIT(KLmNonExistingURI, "file://C:THREAD_%d_PELLE_%d.LDB");
       
   496     
       
   497     TBuf<50> lmDbUri;
       
   498     TBuf<50> lmDbUriCopy;
       
   499         TBuf<50> lmDbNonExistingUri;
       
   500 
       
   501 	TInt j=0;
       
   502 	// Check that some created dbs and copied dbs exist
       
   503 	// Check that non existing db does not exist
       
   504 	
       
   505 	// Check files created by first thread only
       
   506 	index=1;
       
   507 	
       
   508 	for (j=0;j<KCheckIfExistDBs;j++)
       
   509 		{
       
   510 		lmDbUriCopy.Zero();
       
   511 		lmDbUri.Zero();
       
   512 		lmDbUriCopy.Format(KLmURICopy, index, j);
       
   513 		lmDbUri.Format(KLmURI, index, j);
       
   514 		
       
   515 		lmDbNonExistingUri.Zero();
       
   516 		lmDbNonExistingUri.Format(KLmNonExistingURI, index, j);
       
   517 		
       
   518 		// Should exist
       
   519 		TBool res = manager->DatabaseExistsL(lmDbUriCopy);
       
   520 		if (!res) User::Panic(_L("DbNotExist"), -668);
       
   521 		
       
   522 		// Should exist
       
   523 		res = manager->DatabaseExistsL(lmDbUri);
       
   524 		if (!res) User::Panic(_L("DbNotExist"), -669);
       
   525 		
       
   526 		// Should NOT exist
       
   527 		res = manager->DatabaseExistsL(lmDbNonExistingUri);
       
   528 		if (res) User::Panic(_L("DbExist"), -670);
       
   529 		}
       
   530     
       
   531     CleanupStack::PopAndDestroy(manager);
       
   532     }
       
   533     
       
   534 // ---------------------------------------------------------
       
   535 // ThreadFunction
       
   536 //
       
   537 // (other items were commented in a header).
       
   538 // ---------------------------------------------------------
       
   539 //
       
   540 LOCAL_C TInt ThreadFunction(TAny* aData)
       
   541     {
       
   542     CTrapCleanup* cleanup=CTrapCleanup::New(); 
       
   543 
       
   544     CActiveScheduler* actSch = new (ELeave) CActiveScheduler;
       
   545     CActiveScheduler::Install(actSch);
       
   546 
       
   547     TRAPD(err, CPosTp106::RunTestL(aData));
       
   548        
       
   549     delete actSch;
       
   550     delete cleanup;
       
   551     return err;
       
   552     }
       
   553 
       
   554 // ---------------------------------------------------------
       
   555 // CPosTp106::CreateThreadsL
       
   556 //
       
   557 // (other items were commented in a header).
       
   558 // ---------------------------------------------------------
       
   559 //
       
   560 void CPosTp106::CreateThreadsL(const TUint aNoThreads)
       
   561     {
       
   562     _LIT(KThreadName, "Tp106testthread%d");
       
   563     _LIT(KCreateThreadErr, "Create thread failed with %d");
       
   564 
       
   565     for (TUint i=0; i<aNoThreads; i++)
       
   566         {
       
   567         RThread thread;
       
   568         TBuf<32> name;
       
   569 	    name.Format(KThreadName, 1 + iThreadNum++);
       
   570                 
       
   571         TInt err;
       
   572         err = thread.Create(name, ThreadFunction, KDefaultStackSize, KMinHeapSize, KMaxHeapSize, reinterpret_cast<TAny*>(this));
       
   573 
       
   574         AssertTrueSecL(err == KErrNone, KCreateThreadErr, err);                                                                  
       
   575         
       
   576         iThreads.Append(thread);
       
   577         }
       
   578     }
       
   579         
       
   580 //  End of File