win32condition.h

来自「这是VCF框架的代码」· C头文件 代码 · 共 140 行

H
140
字号
#ifndef _VCF_WIN32CONDITION_H__#define _VCF_WIN32CONDITION_H__//Win32Condition.h/*Copyright 2000-2004 The VCF Project.Please see License.txt in the top level directorywhere you installed the VCF.*/#if _MSC_VER > 1000#   pragma once#endif/**Note this code is partially (mostly) based on the condition classfrom the Boost Threads library by William Kempf.Copyright (C) 2001-2003William E. KempfPermission to use, copy, modify, distribute and sell this softwareand its documentation for any purpose is hereby granted without fee,provided that the above copyright notice appear in all copies andthat both that copyright notice and this permission notice appearin supporting documentation.  William E. Kempf makes no representationsabout the suitability of this software for any purpose.It is provided "as is" without express or implied warranty.*/namespace VCF  {/**Class Win32Condition documentationPart/most of the implementation for this class comes fromWilliam E. Kempf's excellent condition class that is apart of the Thread library in Boost. Any mistakes are almostcertainly mine in translating it.*/class Win32Condition : public VCF::Object, public ConditionPeer {public:	enum {		MaxQueue = ((unsigned long)-1)/2	};	Win32Condition( Condition* condition );	virtual ~Win32Condition();	virtual int wait();	virtual int wait( uint32 milliseconds );	virtual void signal();    virtual void broadcast();	virtual OSHandleID getHandleID() {		return (OSHandleID)queue_;	}protected:	Condition* condition_;	HANDLE gate_;    HANDLE queue_;	HANDLE mutex_;	unsigned gone_;  // # threads that timed out and never made it to queue_    unsigned long blocked_; // # threads blocked on the condition    unsigned waiting_; // # threads no longer waiting for the condition but                        // still waiting to be removed from queue_};}; //end of namespace VCF/***CVS Log info*$Log$*Revision 1.4  2005/07/09 23:15:06  ddiego*merging in changes from devmain-0-6-7 branch.**Revision 1.3  2005/01/02 03:04:23  ddiego*merged over some of the changes from the dev branch because they're important resoource loading bug fixes. Also fixes a few other bugs as well.**Revision 1.2.4.1  2004/12/19 04:05:02  ddiego*made modifications to methods that return a handle type. Introduced*a new typedef for handles, that is a pointer, as opposed to a 32bit int,*which was causing a problem for 64bit compiles.**Revision 1.2.4.2  2005/05/05 12:42:27  ddiego*this adds initial support for run loops,*fixes to some bugs in the win32 control peers, some fixes to the win32 edit*changes to teh etxt model so that notification of text change is more*appropriate.**Revision 1.2.4.1  2004/12/19 04:05:02  ddiego*made modifications to methods that return a handle type. Introduced*a new typedef for handles, that is a pointer, as opposed to a 32bit int,*which was causing a problem for 64bit compiles.**Revision 1.2  2004/08/07 02:49:15  ddiego*merged in the devmain-0-6-5 branch to stable**Revision 1.1.2.2  2004/04/29 04:07:14  marcelloptr*reformatting of source files: macros and csvlog and copyright sections**Revision 1.1.2.1  2004/04/28 03:29:41  ddiego*migration towards new directory structure**Revision 1.2.2.1  2004/04/26 21:58:43  marcelloptr*changes for dir reorganization: _VCF_MACRO_H__**Revision 1.2  2004/04/03 15:48:42  ddiego*Merged over code from the 0-6-3 branch.**Revision 1.1.2.2  2004/03/12 04:05:30  ddiego*minor documentation for condition stuff**Revision 1.1.2.1  2004/03/11 22:19:58  ddiego*added condition implementation to FoundationKit.*added a Conditions example to the examples directory.**/#endif // _VCF_WIN32CONDITION_H__

⌨️ 快捷键说明

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