Browse Source

有网友想使用自己的自旋锁

tags/v2.9.7
tearshark 4 years ago
parent
commit
7bea4a2255
2 changed files with 7 additions and 1 deletions
  1. 1
    1
      librf/src/def.h
  2. 6
    0
      librf/src/spinlock.h

+ 1
- 1
librf/src/def.h View File

#pragma once #pragma once
#define LIB_RESUMEF_VERSION 20400 // 2.4.0
#define LIB_RESUMEF_VERSION 20401 // 2.4.1
#if defined(RESUMEF_MODULE_EXPORT) #if defined(RESUMEF_MODULE_EXPORT)
#define RESUMEF_NS export namespace resumef #define RESUMEF_NS export namespace resumef

+ 6
- 0
librf/src/spinlock.h View File

RESUMEF_NS RESUMEF_NS
{ {
#if defined(RESUMEF_USE_CUSTOM_SPINLOCK)
using spinlock = RESUMEF_USE_CUSTOM_SPINLOCK;
#else
struct spinlock struct spinlock
{ {
static const size_t MAX_ACTIVE_SPIN = 1000; static const size_t MAX_ACTIVE_SPIN = 1000;
lck.store(FREE_VALUE, std::memory_order_release); lck.store(FREE_VALUE, std::memory_order_release);
} }
}; };
#endif
} }

Loading…
Cancel
Save