protected void WaitTillFinish(OperationType opt){
		if (opt == OperationType.OT_train)
			allocateQueries();
		
		for(LambdaRankWorker worker:m_workers) {
			worker.setWeight(m_weight);
			worker.setType(opt);//evaluation on training queries
		}
		
		for(int i=0; i<m_threadpool.length; i++){
			m_threadpool[i] = new Thread(m_workers[i]);//everytime, we have to recreate the thread
			m_threadpool[i].start();
		}
		
		for(int i=0; i<m_threadpool.length; i++){
			try {
				m_threadpool[i].join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}