mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
IPC_UNUSED_
This commit is contained in:
parent
b52eae7c90
commit
c625a2e5ff
@ -14,7 +14,7 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- compiler: gcc
|
- compiler: gcc
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
- MATRIX_EVAL="USING_CMAKE=0 CC=gcc-7 && CXX=g++-7"
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
- compiler: clang
|
- compiler: clang
|
||||||
env:
|
env:
|
||||||
|
|||||||
@ -34,7 +34,7 @@ constexpr void static_for(std::index_sequence<I...>, F&& f) {
|
|||||||
#else /*__cplusplus < 201703L*/
|
#else /*__cplusplus < 201703L*/
|
||||||
inline void static_for(std::index_sequence<I...>, F&& f) {
|
inline void static_for(std::index_sequence<I...>, F&& f) {
|
||||||
#endif/*__cplusplus < 201703L*/
|
#endif/*__cplusplus < 201703L*/
|
||||||
auto IPC_UNUSED_ expand = { (f(std::integral_constant<size_t, I>{}), 0)... };
|
IPC_UNUSED_ auto expand = { (f(std::integral_constant<size_t, I>{}), 0)... };
|
||||||
}
|
}
|
||||||
|
|
||||||
template <std::size_t Size>
|
template <std::size_t Size>
|
||||||
|
|||||||
@ -53,7 +53,7 @@ private:
|
|||||||
alloc_t(synchronized* t)
|
alloc_t(synchronized* t)
|
||||||
: t_ { t } {
|
: t_ { t } {
|
||||||
{
|
{
|
||||||
auto IPC_UNUSED_ guard = ipc::detail::unique_lock(t_->lc_);
|
IPC_UNUSED_ auto guard = ipc::detail::unique_lock(t_->lc_);
|
||||||
auto it = t_->allocs_.begin();
|
auto it = t_->allocs_.begin();
|
||||||
if (it != t_->allocs_.end()) {
|
if (it != t_->allocs_.end()) {
|
||||||
std::tie(s_, a_) = *it;
|
std::tie(s_, a_) = *it;
|
||||||
@ -66,7 +66,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
~alloc_t() {
|
~alloc_t() {
|
||||||
auto IPC_UNUSED_ guard = ipc::detail::unique_lock(t_->lc_);
|
IPC_UNUSED_ auto guard = ipc::detail::unique_lock(t_->lc_);
|
||||||
t_->allocs_.emplace(s_, a_);
|
t_->allocs_.emplace(s_, a_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@ void* acquire(char const * name, std::size_t size) {
|
|||||||
auto acc = acc_of(mem);
|
auto acc = acc_of(mem);
|
||||||
acc->fetch_add(1, std::memory_order_release);
|
acc->fetch_add(1, std::memory_order_release);
|
||||||
{
|
{
|
||||||
auto IPC_UNUSED_ guard = ipc::detail::unique_lock(m2h()->lc_);
|
IPC_UNUSED_ auto guard = ipc::detail::unique_lock(m2h()->lc_);
|
||||||
m2h()->cache_.emplace(++acc, std::move(op_name));
|
m2h()->cache_.emplace(++acc, std::move(op_name));
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
@ -76,7 +76,7 @@ void release(void* mem, std::size_t size) {
|
|||||||
if (mem == nullptr) {
|
if (mem == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto IPC_UNUSED_ guard = ipc::detail::unique_lock(m2h()->lc_);
|
IPC_UNUSED_ auto guard = ipc::detail::unique_lock(m2h()->lc_);
|
||||||
auto& cc = m2h()->cache_;
|
auto& cc = m2h()->cache_;
|
||||||
auto it = cc.find(mem);
|
auto it = cc.find(mem);
|
||||||
if (it == cc.end()) {
|
if (it == cc.end()) {
|
||||||
|
|||||||
@ -43,7 +43,7 @@ void* acquire(char const * name, std::size_t size) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto IPC_UNUSED_ guard = ipc::detail::unique_lock(m2h()->lc_);
|
IPC_UNUSED_ auto guard = ipc::detail::unique_lock(m2h()->lc_);
|
||||||
m2h()->cache_.emplace(mem, h);
|
m2h()->cache_.emplace(mem, h);
|
||||||
}
|
}
|
||||||
return mem;
|
return mem;
|
||||||
@ -53,7 +53,7 @@ void release(void* mem, std::size_t /*size*/) {
|
|||||||
if (mem == nullptr) {
|
if (mem == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto IPC_UNUSED_ guard = ipc::detail::unique_lock(m2h()->lc_);
|
IPC_UNUSED_ auto guard = ipc::detail::unique_lock(m2h()->lc_);
|
||||||
auto& cc = m2h()->cache_;
|
auto& cc = m2h()->cache_;
|
||||||
auto it = cc.find(mem);
|
auto it = cc.find(mem);
|
||||||
if (it == cc.end()) {
|
if (it == cc.end()) {
|
||||||
|
|||||||
@ -60,7 +60,7 @@ public:
|
|||||||
if (::pthread_mutexattr_init(&mutex_attr) != 0) {
|
if (::pthread_mutexattr_init(&mutex_attr) != 0) {
|
||||||
return invalid();
|
return invalid();
|
||||||
}
|
}
|
||||||
auto IPC_UNUSED_ guard_mutex_attr = unique_ptr(&mutex_attr, ::pthread_mutexattr_destroy);
|
IPC_UNUSED_ auto guard_mutex_attr = unique_ptr(&mutex_attr, ::pthread_mutexattr_destroy);
|
||||||
if (::pthread_mutexattr_setpshared(&mutex_attr, PTHREAD_PROCESS_SHARED) != 0) {
|
if (::pthread_mutexattr_setpshared(&mutex_attr, PTHREAD_PROCESS_SHARED) != 0) {
|
||||||
return invalid();
|
return invalid();
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ public:
|
|||||||
if (::pthread_condattr_init(&cond_attr) != 0) {
|
if (::pthread_condattr_init(&cond_attr) != 0) {
|
||||||
return invalid();
|
return invalid();
|
||||||
}
|
}
|
||||||
auto IPC_UNUSED_ guard_cond_attr = unique_ptr(&cond_attr, ::pthread_condattr_destroy);
|
IPC_UNUSED_ auto guard_cond_attr = unique_ptr(&cond_attr, ::pthread_condattr_destroy);
|
||||||
if (::pthread_condattr_setpshared(&cond_attr, PTHREAD_PROCESS_SHARED) != 0) {
|
if (::pthread_condattr_setpshared(&cond_attr, PTHREAD_PROCESS_SHARED) != 0) {
|
||||||
return invalid();
|
return invalid();
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
if (::pthread_mutex_lock(&(w->mutex_)) != 0) {
|
if (::pthread_mutex_lock(&(w->mutex_)) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto IPC_UNUSED_ guard = unique_ptr(&(w->mutex_), ::pthread_mutex_unlock);
|
IPC_UNUSED_ auto guard = unique_ptr(&(w->mutex_), ::pthread_mutex_unlock);
|
||||||
if (::pthread_cond_wait(&(w->cond_), &(w->mutex_)) != 0) {
|
if (::pthread_cond_wait(&(w->cond_), &(w->mutex_)) != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user