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

📄 synchlist.h

📁 linux的例子,就是下载后到自己的机子上去运行
💻 H
字号:
// synchlist.h //	Data structures for synchronized access to a list.////	Implemented by surrounding the List abstraction//	with synchronization routines.//// Copyright (c) 1992-1993 The Regents of the University of California.// All rights reserved.  See copyright.h for copyright notice and limitation // of liability and disclaimer of warranty provisions.#ifndef SYNCHLIST_H#define SYNCHLIST_H#include "copyright.h"#include "list.h"#include "synch.h"// The following class defines a "synchronized list" -- a list for which:// these constraints hold://	1. Threads trying to remove an item from a list will//	wait until the list has an element on it.//	2. One thread at a time can access list data structuresclass SynchList {  public:    SynchList();		// initialize a synchronized list    ~SynchList();		// de-allocate a synchronized list    void Append(void *item);	// append item to the end of the list,				// and wake up any thread waiting in remove    void *Remove();		// remove the first item from the front of				// the list, waiting if the list is empty				// apply function to every item in the list    void Mapcar(VoidFunctionPtr func);  private:    List *list;			// the unsynchronized list    Lock *lock;			// enforce mutual exclusive access to the list    Condition *listEmpty;	// wait in Remove if the list is empty};#endif // SYNCHLIST_H

⌨️ 快捷键说明

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