⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uirecycle.c

📁 嵌入工linux开发的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
						if(pWaitingThreadQueue->tid==threadID)
						{
							removeFrom(pSemaThreadList);
							flag1 = 0;
							break;
						}					
					}
					pSemaThreadList = pSemaThreadList->back;
				} // end while(pSemaThreadList)							
			} // end if(iResourceType==SEMAPHORE)
			pCapabilityList = pCapabilityList->back;
		} // end while(pCapabilityList)
		pAllThreadList = pAllThreadList->back;
	} // while(!pAllThreadQueue)

}


/*************************************************************
Function: deleteThreadTree
	Delete the thread tree starting from the given root
	thread.
	If thread A creates thread B and C, thread B creates
	thread D, E, and F, thread C creates thread G and H,
	and thread F creates thread X, Y, Z, the thread tree
	is:
			    A
		          /   \
		        /       \
		      /           \
		     B             C
		   / | \	 /   \
		 /   |   \     /       \
		D    E    F   G         H
		        / | \
		      /   |   \
		     X    Y    Z
	Thread A is the root thread of the tree.

Input:
	rootThreadID - the root thread ID
**************************************************************/
extern int ContactDB_ID;
int deleteThreadTree(int rootThreadID)
{
  struct rootTID rootHeader, *pNodeThreadID;
  int threadID, iRet;

  if(rootThreadID<0) 
	return -1;

  iRet = buildRootList(&rootHeader, rootThreadID);

  if(iRet==-1)
	return -1;

  pNodeThreadID = (struct rootTID *)rootHeader.next;

  while (pNodeThreadID)
  {
	threadID = pNodeThreadID->threadID;
	releaseSemaphoreByThread(threadID);
	sc_deleteThread(threadID);
	signalSemaphoresByThread(threadID);

	releaseTimerByThread(threadID);
	releaseWindowsByThread(threadID);
	releaseAppByThread(threadID);
	
//tong	d_closeByThread(threadID);
	
#ifdef RUN_SYNC_THREAD
//	ContactDB_ID = -1 ;
//	InboxDB_ID = -1 ;
//	OutboxDB_ID = -1 ;
#endif
	
//#ifndef __WIN32__
	closeAllFilesByThread(threadID);
//#endif

    releaseMemoryByThread(threadID);
	
	pNodeThreadID = (struct rootTID *)pNodeThreadID->next;

  }

  clearRootList(&rootHeader);
  return 0;
}


/*************************************************************
Function: showThreadTree
	Show all threads in the thread tree of the given root thread
Input:
	rootThreadID - the root thread ID
**************************************************************/
int showThreadTree(int rootThreadID)
{
  struct rootTID rootHeader, *pNodeThreadID;
  int iRet;

  if(rootThreadID<0) 
	return -1;

  printStringLn("The thread tree is:");

  iRet = buildRootList(&rootHeader, rootThreadID);

  if(iRet==-1)
	return -1;

  pNodeThreadID = (struct rootTID *)rootHeader.next;

  while(pNodeThreadID)
  {
//tong 020611	myPrintInt(pNodeThreadID->threadID, 0);
//tong 020611	myPrintInt(pNodeThreadID->threadID, 0);
	
	pNodeThreadID = (struct rootTID *)pNodeThreadID->next;

	if(pNodeThreadID==0)
	  printStringLn(", [END]");
	else
	  printString(", ");

  }

  clearRootList(&rootHeader);

  return 0;
}


/*************************************************************
Function: showWindowList
	Show the window list
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showWindowList(int toWhere)
{
  TWindow  *pWnd;
  char szText[72];
  int hWnd, queueAddr; 
  int hParentWnd, ownerThreadID; 
  
  pWnd = gpWindowsList;
  
  hWnd = (HNDL)pWnd;
  if(!hWnd)
	  return;
  
  sprintf(szText, "Window list");
  
  if(toWhere==TO_SERIAL_PORT)
	SprintStringLn(szText);
  else
	printStringLn(szText);
  
  sprintf(szText, "Address     QueueAddr   ParentWin   OwnerTID");
  
  if(toWhere==TO_SERIAL_PORT)
	SprintStringLn(szText);
  else
	printStringLn(szText);
  
	sprintf(szText, "------------------------------------------------");
	
	if(toWhere==TO_SERIAL_PORT)
	  SprintStringLn(szText);
	else
	  printStringLn(szText);
	while(hWnd)
	{  
	  hParentWnd = (HNDL)pWnd->parent;
	  ownerThreadID = pWnd->ownerThreadID;
	  queueAddr = (HNDL)pWnd->messageQueue;
	  sprintf(szText, "0x%08x  0x%08x  0x%08x  %-6d", hWnd,
		queueAddr, hParentWnd, ownerThreadID);
	  
	  if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	  else
		printStringLn(szText);
	  
	  pWnd = pWnd->back;
	  hWnd = (HNDL)pWnd;
	}
	
}

/*************************************************************
Function: showApplicationList
	Show the application list
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showApplicationList(int toWhere)
{
	struct dLinkList  *pAppLinkList;
	TPM_APP     *pApp;
	int iAddress, mainID, stackSize, hWnd;
	unsigned short nType, nClass;
	char *pName, szText[72];

	char langType;

	langType = guiQueryLanguageType();

	//pAppLinkList = pdaGetAppList();
	pAppLinkList = &ApplicationList;
	
	pAppLinkList = pAppLinkList->back;
	
	sprintf(szText, "App list");
	if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	else
		printStringLn(szText);

	sprintf(szText, "Address     Name        MainTID   WinHandle   Type  Class  Stacksize");
	if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	else
		printStringLn(szText);

	sprintf(szText, "--------------------------------------------------------------------");
	if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	else
		printStringLn(szText);

	while(pAppLinkList)
	{
		pApp = (TPM_APP *)pAppLinkList->elementPointer;

		iAddress = (HNDL)pApp;

		//pName = pApp->appName;
		pName = pApp->appName[langType];

		mainID = pApp->mainThreadID;

		hWnd = pApp->currentWinHandle;

		nType = pApp->type;
		
		nClass = pApp->classs;
		
		stackSize = pApp->stackSize;
		
		sprintf(szText, "0x%08x  %-10s  %-8d  0x%08x  %-4d  %-5d  %-6d", 
			iAddress, pName, mainID, hWnd, nType, nClass, stackSize);

		if(toWhere==TO_SERIAL_PORT)
			SprintStringLn(szText);
		else
			printStringLn(szText);

		pAppLinkList = pAppLinkList->back;
		
	}

}


/*************************************************************
Function: showTimerList
	Show the PDA timer list
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showTimerList(int toWhere)
{
	TGuiTimer *pTimerTable;
	int iTimerAddr, nEnabled, remainTick;
	int tickMax, iMsgQueueAddr;
	char szText[64];

	pTimerTable = PdaTimerTable;
	
	sprintf(szText, "Timer list");
	if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	else
		printStringLn(szText);

	while(pTimerTable)
	{
		iTimerAddr = (HNDL)pTimerTable;
		nEnabled = pTimerTable->nEnabled;
		remainTick = pTimerTable->dwTickRemain;
		tickMax = pTimerTable->dwTickMax;      
		iMsgQueueAddr = (HNDL)pTimerTable->pMsgQueue;
		
		sprintf(szText, "[%x](%d, %d, %d, %x)", iTimerAddr, nEnabled, remainTick, tickMax, iMsgQueueAddr);
		if(toWhere==TO_SERIAL_PORT)
			SprintStringLn(szText);
		else
			printStringLn(szText);

		pTimerTable = pTimerTable->pNext;
	}
}


/*************************************************************
Function: showThreadList
	Show the thread list
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showThreadList(int toWhere)
{
	struct dLinkList *pThreadList;
	struct thread *pThread;
	int threadID, state;
	int stackSize, parendTID;
	char szText[64];

	pThreadList = AllThreadList.back;

	sprintf(szText, "Thread list");
	if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	else
		printStringLn(szText);

	sprintf(szText, "ID      State   Stacksize  ParentTID");
	if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	else
		printStringLn(szText);
	
	sprintf(szText, "------------------------------------");
	if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	else
		printStringLn(szText);

	while(pThreadList)
	{			
		pThread = (struct thread *)pThreadList->elementPointer;
		
		threadID = pThread->tid;
		state = pThread->state;
		stackSize = pThread->stackSize;
		parendTID = pThread->parentThreadID;
		
		sprintf(szText, "%-6d  %-6d  %-6d     %-6d", threadID, state, stackSize, parendTID);
		if(toWhere==TO_SERIAL_PORT)
			SprintStringLn(szText);
		else
			printStringLn(szText);
	}
}


/*************************************************************
Function: showDatebaseOwners
	Show the owners of the opened database
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
/* tong
#ifndef __WIN32__
void showDatebaseOwners(int toWhere)
{

	TyphoonGlobals *pTyphoon;
	int i, ownerID;
	char szText[32];

	pTyphoon = &typhoon;
	
	sprintf(szText, "atabase owners");
	if(toWhere==TO_SERIAL_PORT)
		SprintStringLn(szText);
	else
		printStringLn(szText);
	
	for(i=0; i<20; i++)
	{
		
		ownerID = pTyphoon->ownerID[i];
		
		sprintf(szText, "[%d](%d", i, ownerID);
		if(toWhere==TO_SERIAL_PORT)
			SprintStringLn(szText);
		else
			printStringLn(szText);

	}

}

#endif
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -