Exemple #1
0
main()
{
  int p,q,i;
  scanf("%d",&N);
  for(i=0;i<=N;i++)tree[i] = CreateQueue();
  for(i=1;i<N;i++)
  {
    scanf("%d%d",&p,&q);
    qPush(tree[p],q);
    qPush(tree[q],p);
  }
  visit[1]=1;
  printf("%d",Min(f(1,0),f(1,1)));
}
Exemple #2
0
/*
* 목적 : 큐에 데이터 삽입을 위한 뮤텍스 추가
*      		 queue - queue handler
*			 link - 데이터 및 Next or Previous 큐 포인터
* 반환값 : 큐 데이터 삽입 결과
* 개정 이력 : 2016.03.17 초기작성
*/
status_t qPushMutex(Queue *queue, QLink *link )
{
  	status_t     status;
  	status = pthread_mutex_lock(&queue->mutex);
  	if (status != EOK) 
   		printLog( "by pcw : gQueue.c : %d... \n",__LINE__);
  	else{    
  		status = qPush(queue, link);
	}
   	pthread_mutex_unlock(&queue->mutex);
  	return(status);
}