亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? buffer.h

?? GNU Common C++ is a very portable and highly optimized class framework for writing C++ applications
?? H
字號:
// Copyright (C) 1999-2005 Open Source Telecom Corporation.//  // This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.// // This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.// // You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.// // As a special exception, you may use this file as part of a free software// library without restriction.  Specifically, if other files instantiate// templates or use macros or inline functions from this file, or you compile// this file and link it with other files to produce an executable, this// file does not by itself cause the resulting executable to be covered by// the GNU General Public License.  This exception does not however// invalidate any other reasons why the executable file might be covered by// the GNU General Public License.//// This exception applies only to the code released under the name GNU// Common C++.  If you copy code from other releases into a copy of GNU // Common C++, as the General Public License permits, the exception does// not apply to the code that you add in this way.  To avoid misleading// anyone as to the status of such modified files, you must delete// this exception notice from them.//// If you write modifications of your own for GNU Common C++, it is your choice// whether to permit this exception to apply to your modifications.// If you do not wish that, delete this exception notice.///** * @file buffer.h * @short object passing services between threads. **/#ifndef	CCXX_BUFFER_H_#define	CCXX_BUFFER_H_#ifndef CCXX_THREAD_H_#include <cc++/thread.h>#endif#ifdef	CCXX_NAMESPACESnamespace ost {#endif/** * The buffer class represents an IPC service that is built upon a buffer * of fixed capacity that can be used to transfer objects between one or * more producer and consumer threads.  Producer threads post objects * into the buffer, and consumer threads wait for and receive objects from * the buffer.  Semaphores are used to to block the buffer from overflowing * and indicate when there is data available, and mutexes are used to protect * multiple consumers and producer threads from stepping over each other. *  * The buffer class is an abstract class in that the actual data being * buffered is not directly specified within the buffer class itself.  The * buffer class should be used as a base class for a class that actually * impliments buffering and which may be aware of the data types actually * are being buffered.  A template class could be created based on buffer * for this purpose.  Another possibility is to create a class derived * from both Thread and Buffer which can be used to implement message passing * threads. *  * @author David Sugar <dyfet@ostel.com> * @short Producer/Consumer buffer for use between threads. */#ifdef	WIN32class __EXPORT Buffer : public Mutex#elseclass __EXPORT Buffer : public Conditional#endif{private:#ifdef	WIN32	HANDLE	sem_head, sem_tail;#endif	size_t _size;	size_t _used;protected:	/**	 * Invoke derived class buffer peeking method.	 * @return size of object found.	 * @param buf pointer to copy contents of head of buffer to.	 */	virtual size_t onPeek(void *buf) = 0;	/**	 * Invoke derived class object request from buffer.	 * @return size of object returned.	 * @param buf pointer to hold object returned from the buffer.	 */	virtual size_t onWait(void *buf) = 0;	/**	 * Invoke derived class posting of object to buffer.	 * @return size of object posted.	 * @param buf pointer to object being posted to the buffer.	 */	virtual size_t onPost(void *buf) = 0;public:	/**	 * value to return when a timed operation returned with a	 * timeout.	 */	static const size_t timeout;	/**	 * Create a buffer object of known capacity.	 * @param capacity is the integer capacity of the buffer.	 */	Buffer(size_t capacity);	/**	 * In derived functions, may be used to free the actual memory	 * used to hold buffered data.	 */	virtual ~Buffer();	/**	 * Return the capacity of the buffer as specified at creation.	 * @return size of buffer.	 */	inline size_t getSize(void)		{return _size;};	/**	 * Return the current capacity in use for the buffer.  Free space	 * is technically getSize() - getUsed().	 * @return integer used capacity of the buffer.	 * @see #getSize	 */	inline size_t getUsed(void)		{return _used;};	/**	 * Let one or more threads wait for an object to become available	 * in the buffer.  The waiting thread(s) will wait forever if no	 * object is ever placed into the buffer.	 *	 * @return size of object passed by buffer in bytes.	 * @param buf pointer to store object retrieved from the buffer.	 * @param timeout time to wait.	 */	size_t wait(void *buf, timeout_t timeout = 0);	/**	 * Post an object into the buffer and enable a waiting thread to	 * receive it.	 *	 * @return size of object posted in bytes.	 * @param buf pointer to object to store in the buffer.	 * @param timeout time to wait.	 */	size_t post(void *buf, timeout_t timeout = 0);	/**	 * Peek at the current content (first object) in the buffer.	 *	 * @return size of object in the buffer.	 * @param buf pointer to store object found in the buffer.	 */	size_t peek(void *buf);	/**	 * New virtual to test if buffer is a valid object.	 * @return true if object is valid.	 */	virtual bool isValid(void);};/** * A buffer class that holds a known capacity of fixed sized objects defined * during creation. * * @author David Sugar <dyfet@ostel.com> * @short producer/consumer buffer for fixed size objects. */class __EXPORT FixedBuffer : public Buffer{private:	char *buf, *head, *tail;	size_t objsize;protected:	/**	 * Return the first object in the buffer.	 * @return predefined size of this buffers objects.	 * @param buf pointer to copy contents of head of buffer to.	 */	size_t onPeek(void *buf);	/**	 * Wait for and return a fixed object in the buffer.	 * @return predefined size of this buffers objects.	 * @param buf pointer to hold object returned from the buffer.	 */	size_t onWait(void *buf);	/**	 * Post an object of the appropriate size into the buffer.	 * @return predefined size of this buffers objects.	 * @param buf pointer to data to copy into the buffer.	 */	size_t onPost(void *buf);public:	/**	 * Create a buffer of known capacity for objects of a specified	 * size.	 *	 * @param capacity of the buffer.	 * @param objsize for each object held in the buffer.	 */	FixedBuffer(size_t capacity, size_t objsize);	/**	 * Create a copy of an existing fixed size buffer and duplicate	 * it's contents.	 *	 * @param fb existing FixedBuffer object.	 */	FixedBuffer(const FixedBuffer &fb);	/**	 * Destroy the fixed buffer and free the memory used to store objects.	 */	virtual ~FixedBuffer();	FixedBuffer &operator=(const FixedBuffer &fb);	bool isValid(void);};/** * Somewhat generic queue processing class to establish a producer * consumer queue.  This may be used to buffer cdr records, or for * other purposes where an in-memory queue is needed for rapid * posting.  This class is derived from Mutex and maintains a linked * list.  A thread is used to dequeue data and pass it to a callback * method that is used in place of "run" for each item present on the * queue.  The conditional is used to signal the run thread when new * data is posted. * * @short in memory data queue interface. * @author David Sugar <dyfet@ostel.com> */class __EXPORT ThreadQueue : public Mutex, public Thread, public Semaphore{private:	typedef struct _data	{		struct _data *next;		unsigned len;		char data[1];	}	data_t;	bool started;	data_t *first, *last;		// head/tail of list	void run(void);			// private run methodprotected:	const char *name;		// used for save/restore file	/**	 * Start of dequeing.  Maybe we need to connect a database	 * or something, so we have a virtual...	 */	virtual void startQueue(void);	/**	 * End of dequeing, we expect the queue is empty for now.  Maybe	 * we need to disconnect a database or something, so we have	 * another virtual.	 */	virtual void stopQueue(void);	/**	 * Virtual callback method to handle processing of a queued	 * data items.  After the item is processed, it is deleted from	 * memory.  We can call multiple instances of runQueue in order	 * if multiple items are waiting.	 *	 * @param data item being dequed.	 */	virtual void runQueue(void *data) = 0;public:	/**	 * Create instance of our queue and give it a process priority.	 *	 * @param id queue ID.	 * @param pri process priority.	 * @param stack stack size.	 */	ThreadQueue(const char *id, int pri, size_t stack = 0);	/**	 * Destroy the queue.	 */	~ThreadQueue();	/**	 * Put some unspecified data into this queue.  A new qd	 * structure is created and sized to contain a copy of	 * the actual content.	 *	 * @param data pointer to data.	 * @param len size of data.	 */	void post(const void *data, unsigned len);};/** @relates Buffer */inline size_t get(Buffer &b, void *o, timeout_t t = 0)	{return b.wait(o, t);}/** @relates Buffer */inline size_t put(Buffer &b, void *o, timeout_t t = 0)	{return b.post(o, t);}/** @relates Buffer */inline size_t peek(Buffer &b, void *o)	{return b.peek(o);}#ifdef	CCXX_NAMESPACES}#endif#endif/** EMACS ** * Local variables: * mode: c++ * c-basic-offset: 8 * End: */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费视频最近日韩| 91视频观看视频| 日韩一区二区免费高清| 日韩精品一二三| 日韩欧美国产三级电影视频| 麻豆成人免费电影| 久久这里都是精品| 粉嫩13p一区二区三区| 亚洲同性同志一二三专区| 91国内精品野花午夜精品| 亚洲福利国产精品| 日韩女优视频免费观看| 夫妻av一区二区| 一区二区三区高清不卡| 欧美一区二区三区影视| 国产精品18久久久久久久久久久久| 亚洲精品一区二区精华| 99精品欧美一区二区三区小说| 亚洲黄色录像片| 日韩欧美的一区| 99久久精品免费看国产免费软件| 亚洲一二三专区| 久久综合视频网| 色综合久久久久综合99| 天天色天天操综合| 中文字幕av免费专区久久| 欧美图区在线视频| 国产成人免费高清| 亚洲mv大片欧洲mv大片精品| 久久精品在线免费观看| 欧美在线观看你懂的| 国产一区二区在线观看免费| 一级中文字幕一区二区| 久久精品免费在线观看| 欧美日韩aaaaa| 岛国av在线一区| 亚洲国产精品视频| 中文字幕欧美激情| 日韩一区二区三区免费观看| 一本色道久久综合狠狠躁的推荐 | 久久精品国产99久久6| 17c精品麻豆一区二区免费| 日韩一级欧美一级| 91一区二区在线| 国产另类ts人妖一区二区| 亚洲成人免费视频| 中文字幕一区二区日韩精品绯色| 日韩视频免费观看高清在线视频| 色综合久久99| 成人午夜在线视频| 久久国产剧场电影| 无码av中文一区二区三区桃花岛| 中文字幕亚洲一区二区av在线 | 精品久久人人做人人爰| 在线观看欧美精品| 99久久精品久久久久久清纯| 国产精品亚洲а∨天堂免在线| 日韩国产精品久久久久久亚洲| 一区二区三区中文字幕在线观看| 亚洲一区二区三区四区在线免费观看| 亚洲精品一区二区三区香蕉| 日韩视频一区在线观看| 欧美日韩国产影片| 欧美亚洲国产一区二区三区 | av不卡在线播放| 国产成人在线看| 狠狠色狠狠色综合| 激情综合色播激情啊| 日韩成人av影视| 日韩国产欧美三级| 婷婷夜色潮精品综合在线| 亚洲尤物视频在线| 亚洲影院理伦片| 亚洲成人资源网| 亚洲国产精品久久艾草纯爱| 亚洲午夜久久久久久久久久久| 亚洲乱码一区二区三区在线观看| 1区2区3区国产精品| 中文字幕在线视频一区| 国产精品美女久久久久久久久久久 | 亚洲bdsm女犯bdsm网站| 亚洲午夜精品在线| 午夜欧美电影在线观看| 午夜在线成人av| 天堂影院一区二区| 日本不卡一二三| 久久国产精品色| 国产99精品在线观看| 成人av中文字幕| 91一区一区三区| 欧美日韩亚洲高清一区二区| 欧美日韩黄色一区二区| 欧美日韩dvd在线观看| 欧美大片免费久久精品三p| 久久网站最新地址| 国产精品福利电影一区二区三区四区| **欧美大码日韩| 亚洲一区二区av电影| 日本韩国欧美三级| 欧美日韩在线观看一区二区| 4438x成人网最大色成网站| 日韩美一区二区三区| 欧美国产日韩一二三区| 亚洲免费三区一区二区| 视频一区免费在线观看| 国内精品免费**视频| 99久久99久久综合| 欧美日韩国产首页| 久久久亚洲精品一区二区三区| 亚洲私人黄色宅男| 日韩av一区二| 成人高清视频在线| 欧美日韩亚洲另类| 国产日韩欧美电影| 五月天中文字幕一区二区| 国产一区二区三区四| 色综合欧美在线| 久久网站最新地址| 亚洲国产日韩精品| 国产91在线看| 欧美日韩成人高清| 国产精品久久久久影院老司| 亚洲gay无套男同| 大美女一区二区三区| 欧美一区二区视频在线观看| 国产精品视频第一区| 日本成人在线电影网| 不卡在线观看av| 欧美大片一区二区| 一区二区三区在线高清| 国产精品亚洲第一| 9191久久久久久久久久久| 国产精品不卡一区| 精品综合久久久久久8888| 色综合久久中文字幕| 丝袜亚洲另类丝袜在线| 99国产精品国产精品毛片| 欧美精品一区二| 亚洲国产精品一区二区www在线| 福利91精品一区二区三区| 欧美高清视频不卡网| 国产精品理论片在线观看| 久久成人羞羞网站| 欧美美女直播网站| 一区二区三区高清不卡| 成人黄色在线网站| 国产午夜精品一区二区三区视频 | www..com久久爱| 久久久av毛片精品| 琪琪一区二区三区| 欧美精品欧美精品系列| 一区二区三区 在线观看视频| 成人一区二区在线观看| 久久奇米777| 精品一区二区三区香蕉蜜桃| 91麻豆精品国产自产在线观看一区| 亚洲三级小视频| 北条麻妃一区二区三区| 国产情人综合久久777777| 国产乱国产乱300精品| 精品久久久久久久久久久久包黑料| 午夜激情久久久| 欧美精品亚洲一区二区在线播放| 亚洲综合一区在线| 色视频欧美一区二区三区| 一区视频在线播放| 99久久精品免费精品国产| 亚洲素人一区二区| 色综合av在线| 一区二区三区中文在线观看| 色综合久久99| 夜夜精品浪潮av一区二区三区| 一本久久综合亚洲鲁鲁五月天| 亚洲特黄一级片| 欧美最猛黑人xxxxx猛交| 亚洲一线二线三线久久久| 欧美视频一区二| 日韩av高清在线观看| 日韩一级大片在线| 国内国产精品久久| 国产精品色婷婷久久58| 99久久夜色精品国产网站| 亚洲三级在线免费| 欧美人牲a欧美精品| 美女免费视频一区| 久久精品人人做| 91小视频在线免费看| 成人免费av资源| 亚洲视频中文字幕| 欧美疯狂性受xxxxx喷水图片| 蜜桃av一区二区三区电影| 久久久久国色av免费看影院| 成年人国产精品| 夜夜嗨av一区二区三区网页| 欧美一区三区二区| 国产露脸91国语对白| 一区二区三区四区亚洲| 欧美一级日韩不卡播放免费| 国产成人免费视频| 亚洲免费av网站|