예제 #1
0
void PCCoreDestory(struct ST_ProtocolEngine* pProtocolEngine)
{	
	QueueDestory(&pProtocolEngine->pPCCore->pReaderQueue);
	QueueDestory(&pProtocolEngine->pPCCore->pSenderQueue);
	QueueDestory(&pProtocolEngine->pPCCore->pCallbackQueue);
	
	//VarKeeperDestory(&pIMnetCore->pVarKeeper);

	LooperDestory(&pProtocolEngine->pPCCore->pReaderLooper);
	LooperDestory(&pProtocolEngine->pPCCore->pSenderLooper);
	LooperDestory(&pProtocolEngine->pPCCore->pCallbackLooper);

	AMFree(pProtocolEngine->pPCCore);
}
예제 #2
0
파일: maze.c 프로젝트: funning/algorithm
int branchAndBound(int myMaze[][9], Postion start, Postion end) {
	int ok = 0;
	Queue* q = tk_calloc(1, sizeof(Queue));
	Postion* tmp = tk_calloc(1, sizeof(Postion));

	stack* s = stack_init(1);
	tmp->x = start.x;
	tmp->y = start.y;
	myMaze[start.y][start.x] = BASEVAULE;
	while(tmp != 0) {
		stack_push(s, tmp);
		if (dealNodeR(myMaze, q, tmp, start, end) == 1) {
			ok = 1;
			break;
		}
		tmp = QueueGet(q);
	}

	if (ok == 1) {
		markPoit(myMaze, s, end);
		stack_destory(s);
	}
	QueueDestory(q);
	tk_bookkeeper_mem_report();
	return ok;
}
예제 #3
0
void QueueTest()
{
	Queue q;
	//QueueInit(&q);
	//QueuePush(&q, 1);
	//QueuePush(&q, 2);
	//QueuePush(&q, 3);
	////printf("%d\n",QueueFront(&q));
	////QueuePop(&q);
	//printf("%d\n", QueueEmpty(&q));
	//printf("%d\n", QueueSize(&q));
	//QueuePrint(&q);
	QueueDestory(&q);
}
예제 #4
0
파일: maze.c 프로젝트: funning/algorithm
void markPoit(int myMaze[][9], stack* s, Postion end) {
	Postion* p = stack_pop(s);
	Queue* q = QueueInit();
	Postion current = end;
	while(p != 0) {
		if (isNear(*p, current) == 1) {
			myMaze[p->y][p->x] = 1;
			current = *p;
			QueueAdd(q, p);
		} else {
			tk_free(p);
		}
		p = stack_pop(s);
	}
	p = QueueGet(q);
	printf("(5,5)");
	while(p != 0) {
		printf("<-(%d,%d)", p->x, p->y);
		tk_free(p);
		p = QueueGet(q);
	}
	printf("\n");
	QueueDestory(q);
}