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

📄 uirecycle.h

📁 嵌入工linux开发的源码
💻 H
字号:
/******************************************************************************
 FILE: recycle.h (/rtos/kernel/usrlib/pda_win/include/)
 
 Resource Recycle Module

 Copyright (c) 2001, III Technology Research Division

 AUTHOR: MSC <msc@iii.org.tw>

 HISTORY:

*******************************************************************************
*/


#ifndef _RECYCLE_H
#define _RECYCLE_H

#include <kernel/sema.h>


#define RECYCLE_DEBUG


/*************************************************************
Function : releaseTimerByThread()
	Delete the timers of the target thread
Input:
	tid - target thread ID
**************************************************************/
void releaseTimerByThread(int tid);



/*************************************************************
Function: releaseOrphanTimers()
	Delete all timers belonging to threads that have
	exited or have been terminated.
**************************************************************/
void releaseOrphanTimers(void);



/*************************************************************
Function : releaseWindowsByThread()
	Delete the windows of the target thread
Input:
	tid - target thread ID
**************************************************************/
void releaseWindowsByThread(int tid);



/*************************************************************
Function: releaseOrphanWindows()
	Delete all windows belonging to threads that have
	exited or have been terminated.
**************************************************************/
void releaseOrphanWindows(void);



/*************************************************************
Function : releaseAppByThread()
	Unlinked the application with its associated thread
Input:
	tid - target thread ID
**************************************************************/
void releaseAppByThread(int tid);



/*************************************************************
Function : releaseOrphanApps()
	Check if the thread linked to an application is still
	working. If not, break the link.
**************************************************************/
void releaseOrphanApps(void);



/*************************************************************
Function : releaseSemaphoreByThread
	Remove the semaphores created by the target thread from
	SemaphoreList
Input:
	tid - target thread ID
Note:
	The semaphore is not actually deleted. This function
	only removed the semaphore from SemaphoreList in case
	RUN_OS_MONITOR is defined. The semaphores created by
	a thread will be automatically deleted when the thread
	is deleted.
**************************************************************/
void releaseSemaphoreByThread(int tid);



/****************************************************************
Function: signalInRecycle
Description:
	signal a semaphore in recycling
Input:
	s - the semaphore
Note:
	This function acts like signal(), except that it only get
	the highest priority thread back to the ready queue and
	no thread switching is involved.
*****************************************************************/
int signalInRecycle(struct semaphore *s);



/*************************************************************
Function: signalSemaphoresByThread
	Signal all semaphores that are currently used by the
	target thread and remove the target thread from the
	waiting list of all semaphores
Input:
	tid - target thread ID
Note:
	A thread may be the current users of two or more
	semaphores, so we have to check all semaphores to see
	if the target thread is the current user. However, a
	thread can only wait for one semaphore at any time, so
	we can stop checking the waiting thread list once the
	thread has been found in one waiting list and removed
	from the list.

	This function works only for binary semaphores. In case
	of the other semaphores, only the resources of the
	latest user will be recycled.
**************************************************************/
void signalSemaphoresByThread(int tid);



/*************************************************************
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
**************************************************************/
int deleteThreadTree(int rootThreadID);



#ifdef RECYCLE_DEBUG

/*************************************************************
Function: showThreadTree
	Show all threads in the thread tree of the given root thread
Input:
	rootThreadID - the root thread ID
**************************************************************/
int showThreadTree(int rootThreadID);

/*************************************************************
Function: showWindowList
	Show the window list
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showWindowList(int toWhere);

/*************************************************************
Function: showApplicationList
	Show the application list
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showApplicationList(int toWhere);

/*************************************************************
Function: showTimerList
	Show the PDA timer list
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showTimerList(int toWhere);

/*************************************************************
Function: showThreadList
	Show the thread list
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showThreadList(int toWhere);

/*************************************************************
Function: showDatebaseOwners
	Show the owners of the opened database
Input:
	toWhere - TO_MONITOR, TO_SERIAL_PORT
**************************************************************/
void showDatebaseOwners(int toWhere);

#endif	// #ifdef RECYCLE_DEBUG


#endif

⌨️ 快捷键说明

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