Browse Source

确保批量解锁的顺序

tags/v2.9.7
tearshark 4 years ago
parent
commit
fab455a02d
4 changed files with 6 additions and 5 deletions
  1. 1
    1
      librf/src/def.h
  2. 1
    2
      librf/src/mutex_v2.inl
  3. 2
    0
      librf/src/state.h
  4. 2
    2
      vs_proj/librf.vcxproj

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

#pragma once #pragma once
#define LIB_RESUMEF_VERSION 20901 // 2.9.1
#define LIB_RESUMEF_VERSION 20902 // 2.9.2
#if defined(RESUMEF_MODULE_EXPORT) #if defined(RESUMEF_MODULE_EXPORT)
#define RESUMEF_NS export namespace resumef #define RESUMEF_NS export namespace resumef

+ 1
- 2
librf/src/mutex_v2.inl View File

{ {
assert(unique_address != nullptr); assert(unique_address != nullptr);


int _Ignored[] = { (mtxs.unlock(unique_address), 0)... };
(void)_Ignored;
(..., mtxs.unlock(unique_address));
} }
} }
} }

+ 2
- 0
librf/src/state.h View File

inline bool is_ready() const noexcept inline bool is_ready() const noexcept
{ {
#pragma warning(disable : 6326) //warning C6326: Potential comparison of a constant with another constant.
//msvc认为是constexpr表达式(不写还给警告),然而,clang不这么认为。 //msvc认为是constexpr表达式(不写还给警告),然而,clang不这么认为。
//放弃constexpr,反正合格的编译器都会优化掉这个if判断的。 //放弃constexpr,反正合格的编译器都会优化掉这个if判断的。
if if
return 0 != reinterpret_cast<const std::atomic<uint16_t> &>(_has_value).load(std::memory_order_acquire); return 0 != reinterpret_cast<const std::atomic<uint16_t> &>(_has_value).load(std::memory_order_acquire);
else else
return _has_value.load(std::memory_order_acquire) != result_type::None || _is_future; return _has_value.load(std::memory_order_acquire) != result_type::None || _is_future;
#pragma warning(default : 6326)
} }
inline bool has_handler_skip_lock() const noexcept inline bool has_handler_skip_lock() const noexcept
{ {

+ 2
- 2
vs_proj/librf.vcxproj View File

<ProjectGuid>{C1D4A6BD-592F-4E48-8178-7C87219BF80E}</ProjectGuid> <ProjectGuid>{C1D4A6BD-592F-4E48-8178-7C87219BF80E}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>librf</RootNamespace> <RootNamespace>librf</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>ClangCL</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>

Loading…
Cancel
Save