Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
develop
Branches (106)
Tags (124)
develop
master
feature/gha
feature/requires-cxx11
feature/appveyor
feature/pr-393
feature/pr-386
feature/gha2
feature/pr-324
feature/issue-366
feature/pr-354
feature/pr-320
feature/update-appveyor
feature/travis-j3
feature/update-travis
feature/boost-bind-message
pr/fix-cygwin-win32
pr/fix-detail-winapi
feature/timespec_clocks
pr/fix-gcc48-failures
boost-1.91.0.beta1
boost-1.89.0
boost-1.90.0
boost-1.90.0.beta1
boost-1.88.0
boost-1.88.0.beta1
boost-1.84.0
boost-1.84.0.beta1
boost-1.85.0
boost-1.85.0.beta1
boost-1.86.0
boost-1.86.0.beta1
boost-1.87.0
boost-1.87.0.beta1
boost-1.82.0
boost-1.82.0.beta1
boost-1.83.0
boost-1.83.0.beta1
boost-1.80.0
boost-1.80.0.beta1
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
The license selected for the repository is subject to the license used by the main branch of the repository.
develop
Branches (106)
Tags (124)
develop
master
feature/gha
feature/requires-cxx11
feature/appveyor
feature/pr-393
feature/pr-386
feature/gha2
feature/pr-324
feature/issue-366
feature/pr-354
feature/pr-320
feature/update-appveyor
feature/travis-j3
feature/update-travis
feature/boost-bind-message
pr/fix-cygwin-win32
pr/fix-detail-winapi
feature/timespec_clocks
pr/fix-gcc48-failures
boost-1.91.0.beta1
boost-1.89.0
boost-1.90.0
boost-1.90.0.beta1
boost-1.88.0
boost-1.88.0.beta1
boost-1.84.0
boost-1.84.0.beta1
boost-1.85.0
boost-1.85.0.beta1
boost-1.86.0
boost-1.86.0.beta1
boost-1.87.0
boost-1.87.0.beta1
boost-1.82.0
boost-1.82.0.beta1
boost-1.83.0
boost-1.83.0.beta1
boost-1.80.0
boost-1.80.0.beta1
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
develop
Branches (106)
Tags (124)
develop
master
feature/gha
feature/requires-cxx11
feature/appveyor
feature/pr-393
feature/pr-386
feature/gha2
feature/pr-324
feature/issue-366
feature/pr-354
feature/pr-320
feature/update-appveyor
feature/travis-j3
feature/update-travis
feature/boost-bind-message
pr/fix-cygwin-win32
pr/fix-detail-winapi
feature/timespec_clocks
pr/fix-gcc48-failures
boost-1.91.0.beta1
boost-1.89.0
boost-1.90.0
boost-1.90.0.beta1
boost-1.88.0
boost-1.88.0.beta1
boost-1.84.0
boost-1.84.0.beta1
boost-1.85.0
boost-1.85.0.beta1
boost-1.86.0
boost-1.86.0.beta1
boost-1.87.0
boost-1.87.0.beta1
boost-1.82.0
boost-1.82.0.beta1
boost-1.83.0
boost-1.83.0.beta1
boost-1.80.0
boost-1.80.0.beta1
thread
/
src
/
pthread
/
once.cpp
thread
/
src
/
pthread
/
once.cpp
once.cpp 2.81 KB
Copy Edit Raw Blame History
Austin Beer authored 2019年04月02日 00:00 +08:00 . Fix Issue 275
// Copyright (C) 2007 Anthony Williams
//
// 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)
#include <boost/thread/detail/config.hpp>
#ifdef BOOST_THREAD_ONCE_ATOMIC
#include "./once_atomic.cpp"
#else
#define __STDC_CONSTANT_MACROS
#include <boost/thread/once.hpp>
#include <boost/assert.hpp>
#include <boost/throw_exception.hpp>
#include <pthread.h>
#include <stdlib.h>
#include <memory>
#include <string.h> // memcmp.
namespace boost
{
namespace thread_detail
{
BOOST_THREAD_DECL uintmax_atomic_t once_global_epoch=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C;
BOOST_THREAD_DECL pthread_mutex_t once_epoch_mutex=PTHREAD_MUTEX_INITIALIZER;
BOOST_THREAD_DECL pthread_cond_t once_epoch_cv = PTHREAD_COND_INITIALIZER;
namespace
{
pthread_key_t epoch_tss_key;
pthread_once_t epoch_tss_key_flag=PTHREAD_ONCE_INIT;
extern "C"
{
static void delete_epoch_tss_data(void* data)
{
free(data);
}
static void create_epoch_tss_key()
{
BOOST_VERIFY(!pthread_key_create(&epoch_tss_key,delete_epoch_tss_data));
}
}
#if defined BOOST_THREAD_PATCH
const pthread_once_t pthread_once_init_value=PTHREAD_ONCE_INIT;
struct BOOST_THREAD_DECL delete_epoch_tss_key_on_dlclose_t
{
delete_epoch_tss_key_on_dlclose_t()
{
}
~delete_epoch_tss_key_on_dlclose_t()
{
if(memcmp(&epoch_tss_key_flag, &pthread_once_init_value, sizeof(pthread_once_t)))
{
void* data = pthread_getspecific(epoch_tss_key);
if (data)
delete_epoch_tss_data(data);
pthread_key_delete(epoch_tss_key);
}
}
};
delete_epoch_tss_key_on_dlclose_t delete_epoch_tss_key_on_dlclose;
#endif
}
uintmax_atomic_t& get_once_per_thread_epoch()
{
BOOST_VERIFY(!pthread_once(&epoch_tss_key_flag,create_epoch_tss_key));
void* data=pthread_getspecific(epoch_tss_key);
if(!data)
{
data=malloc(sizeof(thread_detail::uintmax_atomic_t));
if(!data) BOOST_THROW_EXCEPTION(std::bad_alloc());
BOOST_VERIFY(!pthread_setspecific(epoch_tss_key,data));
*static_cast<thread_detail::uintmax_atomic_t*>(data)=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C;
}
return *static_cast<thread_detail::uintmax_atomic_t*>(data);
}
}
}
#endif //
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

boost_thread, c++11, c++14
Cancel

Releases

No release

Contributors

All

Language(Optional)

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/public_share/thread.git
git@gitee.com:public_share/thread.git
public_share
thread
boost_thread
develop
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /