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

📄 dllist.h

📁 nachos下并发程序设计。编写双向链表并演示并发错误。包含文件Makefile.common、main.cc、threadtest.cc、dllist-driver.cc、dllist.cc、dll
💻 H
字号:
#ifndef DLLIST_INCLUDED
#define DLLIST_INCLUDED

class DLLElement 
{
public:
	DLLElement(void *itermptr,int sortKey); // initiallize a list element
	DLLElement *next; //next element on list, NULL if this is the last
	DLLElement *prev;// previous element on list NULL if this is the first

	int key; //priority,for a sorted list
	void *item; //pointer to item on the list
};

class DLList
{
public:
	DLList();   //initialize the list
	~DLList(); // de-allocate the list

	void Prepend(void *item);  //add to the head of the list
	void Append(void *item);   //add to the tail of the list
	void *Remove(int *keyPtr); //remove from the list

	bool IsEmpty();           // return true if the list has no element

	void SortedInsert(void *item, int sortKey);  //put items on list in order
	void *SortedRemove(int sortKey); // remove first item with key==sortKey return NULL if no such item

private:
	DLLElement *first;    //head of the list , null if empty
	DLLElement *last;    //tail of the list ,null if empty

};

extern void ListInsert(int n,DLList *list,int t_num);  //insert n elements to the list 
extern void ListRemove(int n,DLList *list,int t_num);  //remove n elements to the list
extern int Thread_num,Node_num,Flag;  
//extern Thread* currentThread;
#endif



⌨️ 快捷键说明

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