Example #1
0
TVMStatus VMMemoryPoolDelete(TVMMemoryPoolID memory){
	TMachineSignalState sigState;	
	MachineSuspendSignals(&sigState);
	ThreadStore* tStore = ThreadStore::getInstance();
	MemoryPool *pool = tStore->findMemoryPoolByID(memory);
	
//	printf("Attempting to delete memory pool MID: %d\n", memory);

	if(pool == NULL){
		printf("VMMemoryPoolDelete(): pool was null.\n");
		return VM_STATUS_ERROR_INVALID_PARAMETER;
	}

	if(pool->isInUse()){	//returns TRUE if any memory is allocated in the pool
		printf("VMMemoryPoolDelete(): pool still has memory allocated, so it cannot be deleted.\n");
		return VM_STATUS_ERROR_INVALID_STATE;	
	}

//	printf("VMMemoryPoolDelete(): pool deleted successfully!\n");
	tStore->deleteMemoryPool(memory);
	MachineResumeSignals(&sigState);
	return VM_STATUS_SUCCESS;
}