x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
tss.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\thread\pthread\tss.hpp
旋转
特效
属性
历史版本
#ifndef BOOST_THREAD_PTHREAD_TSS_HPP #define BOOST_THREAD_PTHREAD_TSS_HPP // 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) // (C) Copyright 2007 Anthony Williams #include
#include
namespace boost { namespace detail { struct tss_cleanup_function { virtual ~tss_cleanup_function() {} virtual void operator()(void* data)=0; }; BOOST_THREAD_DECL void set_tss_data(void const* key,boost::shared_ptr
func,void* tss_data,bool cleanup_existing); BOOST_THREAD_DECL void* get_tss_data(void const* key); } template
class thread_specific_ptr { private: thread_specific_ptr(thread_specific_ptr&); thread_specific_ptr& operator=(thread_specific_ptr&); struct delete_data: detail::tss_cleanup_function { void operator()(void* data) { delete static_cast
(data); } }; struct run_custom_cleanup_function: detail::tss_cleanup_function { void (*cleanup_function)(T*); explicit run_custom_cleanup_function(void (*cleanup_function_)(T*)): cleanup_function(cleanup_function_) {} void operator()(void* data) { cleanup_function(static_cast
(data)); } }; boost::shared_ptr
cleanup; public: thread_specific_ptr(): cleanup(new delete_data) {} explicit thread_specific_ptr(void (*func_)(T*)): cleanup(new run_custom_cleanup_function(func_)) {} ~thread_specific_ptr() { reset(); } T* get() const { return static_cast
(detail::get_tss_data(this)); } T* operator->() const { return get(); } T& operator*() const { return *get(); } T* release() { T* const temp=get(); detail::set_tss_data(this,boost::shared_ptr
(),0,false); return temp; } void reset(T* new_value=0) { T* const current_value=get(); if(current_value!=new_value) { detail::set_tss_data(this,cleanup,new_value,true); } } }; } #endif
tss.hpp
网页地址
文件地址
上一页
11/11 下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.