x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
interprocess_barrier.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\interprocess\sync\interprocess_barrier.hpp
旋转
特效
属性
历史版本
////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2005-2008. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/interprocess for documentation. // ////////////////////////////////////////////////////////////////////////////// // // barrier is a modified version of Boost Threads barrier // ////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002-2003 // David Moore, William E. Kempf // // Permission to use, copy, modify, distribute and sell this software // and its documentation for any purpose is hereby granted without fee, // provided that the above copyright notice appear in all copies and // that both that copyright notice and this permission notice appear // in supporting documentation. William E. Kempf makes no representations // about the suitability of this software for any purpose. // It is provided "as is" without express or implied warranty. #ifndef BOOST_INTERPROCESS_BARRIER_HPP #define BOOST_INTERPROCESS_BARRIER_HPP #if (defined _MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif #include
#include
#if defined BOOST_INTERPROCESS_POSIX_PROCESS_SHARED && defined BOOST_INTERPROCESS_POSIX_BARRIERS # include
# include
# include
# define BOOST_INTERPROCESS_USE_POSIX #else # include
# include
# include
# include
# define BOOST_INTERPROCESS_USE_GENERIC_EMULATION #endif # include
namespace boost { namespace interprocess { //!An object of class barrier is a synchronization primitive that //!can be placed in shared memory used to cause a set of threads from //!different processes to wait until they each perform a certain //!function or each reach a particular point in their execution. class barrier { public: //!Constructs a barrier object that will cause count threads //!to block on a call to wait(). barrier(unsigned int count); //!Destroys *this. If threads are still executing their wait() //!operations, the behavior for these threads is undefined. ~barrier(); //!Effects: Wait until N threads call wait(), where N equals the count //!provided to the constructor for the barrier object. //!Note that if the barrier is destroyed before wait() can return, //!the behavior is undefined. //!Returns: Exactly one of the N threads will receive a return value //!of true, the others will receive a value of false. Precisely which //!thread receives the return value of true will be implementation-defined. //!Applications can use this value to designate one thread as a leader that //!will take a certain action, and the other threads emerging from the barrier //!can wait for that action to take place. bool wait(); /// @cond private: #if defined(BOOST_INTERPROCESS_USE_GENERIC_EMULATION) interprocess_mutex m_mutex; interprocess_condition m_cond; unsigned int m_threshold; unsigned int m_count; unsigned int m_generation; #else //#if defined BOOST_INTERPROCESS_USE_POSIX pthread_barrier_t m_barrier; #endif//#if defined BOOST_INTERPROCESS_USE_POSIX /// @endcond }; } // namespace interprocess } // namespace boost #ifdef BOOST_INTERPROCESS_USE_GENERIC_EMULATION # undef BOOST_INTERPROCESS_USE_GENERIC_EMULATION # include
#endif #ifdef BOOST_INTERPROCESS_USE_POSIX # undef BOOST_INTERPROCESS_USE_POSIX # include
#endif #include
#endif
interprocess_barrier.hpp
网页地址
文件地址
上一页
2/18
下一页
下载
( 4 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.