kernel/eka/common/heap.cpp
changeset 15 4122176ea935
parent 0 a41df078684a
child 258 880ff05ad710
equal deleted inserted replaced
0:a41df078684a 15:4122176ea935
  1202 	// Create the thread's heap chunk.
  1202 	// Create the thread's heap chunk.
  1203 	RChunk c;
  1203 	RChunk c;
  1204 	TChunkCreateInfo createInfo;
  1204 	TChunkCreateInfo createInfo;
  1205 	createInfo.SetThreadHeap(0, maxLength, KLitDollarHeap());	// Initialise with no memory committed.
  1205 	createInfo.SetThreadHeap(0, maxLength, KLitDollarHeap());	// Initialise with no memory committed.
  1206 
  1206 
  1207 	// Set the heap chunk to be paged or unpaged based on the thread's settings.
  1207 	// Set the paging policy of the heap chunk based on the thread's paging policy.
  1208 	// aInfo.iFlags will have already been set by the kernel based on the paging policies.
  1208 	TUint pagingflags = aInfo.iFlags & EThreadCreateFlagPagingMask;
  1209 	TBool paged = (aInfo.iFlags & EThreadCreateFlagPagingMask) == EThreadCreateFlagPaged;
  1209 	switch (pagingflags)
  1210 	TChunkCreateInfo::TChunkPagingAtt paging = 
  1210 		{
  1211 		(paged)? TChunkCreateInfo::EPaged : TChunkCreateInfo::EUnpaged;
  1211 		case EThreadCreateFlagPaged:
  1212 	createInfo.SetPaging(paging);
  1212 			createInfo.SetPaging(TChunkCreateInfo::EPaged);
       
  1213 			break;
       
  1214 		case EThreadCreateFlagUnpaged:
       
  1215 			createInfo.SetPaging(TChunkCreateInfo::EUnpaged);
       
  1216 			break;
       
  1217 		case EThreadCreateFlagPagingUnspec:
       
  1218 			// Leave the chunk paging policy unspecified so the process's 
       
  1219 			// paging policy is used.
       
  1220 			break;
       
  1221 		}
  1213 
  1222 
  1214 	TInt r = c.Create(createInfo);
  1223 	TInt r = c.Create(createInfo);
  1215 	if (r!=KErrNone)
  1224 	if (r!=KErrNone)
  1216 		return r;
  1225 		return r;
  1217 
  1226