@@ -33,7 +33,7 @@ | |||
#include <thread> | |||
#include <iostream> | |||
#include <assert.h> | |||
#if defined(__clang__) && (__APPLE__ || WIN32) | |||
#if defined(__clang__) | |||
#include "src/unix/coroutine.h" //编译器内建的协程函数,MSVC和clang不一样 | |||
#else | |||
#include <experimental/coroutine> |
@@ -64,7 +64,7 @@ inline namespace channel_v2 | |||
*/ | |||
template<class U | |||
#ifndef DOXYGEN_SKIP_PROPERTY | |||
COMMA_RESUMEF_ENABLE_IF(std::is_constructible_v<value_type, U&&>) | |||
COMMA_RESUMEF_ENABLE_IF(std::is_constructible_v<_Ty, U&&>) | |||
#endif //DOXYGEN_SKIP_PROPERTY | |||
> | |||
#ifndef DOXYGEN_SKIP_PROPERTY | |||
@@ -81,7 +81,7 @@ inline namespace channel_v2 | |||
*/ | |||
template<class U | |||
#ifndef DOXYGEN_SKIP_PROPERTY | |||
COMMA_RESUMEF_ENABLE_IF(std::is_constructible_v<value_type, U&&>) | |||
COMMA_RESUMEF_ENABLE_IF(std::is_constructible_v<_Ty, U&&>) | |||
#endif //DOXYGEN_SKIP_PROPERTY | |||
> | |||
#ifndef DOXYGEN_SKIP_PROPERTY |
@@ -14,9 +14,9 @@ | |||
#ifndef RESUMEF_ENABLE_CONCEPT | |||
#ifdef __cpp_lib_concepts | |||
#define RESUMEF_ENABLE_CONCEPT 1 | |||
#define RESUMEF_ENABLE_CONCEPT 0 | |||
#else | |||
#define RESUMEF_ENABLE_CONCEPT 1 | |||
#define RESUMEF_ENABLE_CONCEPT 0 | |||
#endif //#ifdef __cpp_lib_concepts | |||
#endif //#ifndef RESUMEF_ENABLE_CONCEPT | |||
@@ -1,5 +1,9 @@ | |||
#pragma once | |||
#ifndef _offset_of | |||
#define _offset_of(c, m) reinterpret_cast<size_t>(&static_cast<c *>(0)->m) | |||
#endif | |||
#define co_yield_void co_yield nullptr | |||
#define co_return_void co_return nullptr | |||
@@ -153,7 +153,7 @@ namespace resumef | |||
#ifndef __clang__ | |||
constexpr | |||
#endif | |||
(offsetof(state_future_t, _is_future) - offsetof(state_future_t, _has_value) == 1) | |||
(_offset_of(state_future_t, _is_future) - _offset_of(state_future_t, _has_value) == 1) | |||
return 0 != reinterpret_cast<const std::atomic<uint16_t> &>(_has_value).load(std::memory_order_acquire); | |||
else | |||
return _has_value.load(std::memory_order_acquire) != result_type::None || _is_future; |
@@ -38,8 +38,8 @@ int main(int argc, const char* argv[]) | |||
//test_ring_queue<resumef::ring_queue_spinlock<int, false, uint32_t>>(); | |||
//test_ring_queue<resumef::ring_queue_lockfree<int, uint64_t>>(); | |||
resumable_main_event(); | |||
return 0; | |||
//resumable_main_event(); | |||
//return 0; | |||
//if (argc > 1) | |||
// resumable_main_benchmark_asio_client(atoi(argv[1])); |
@@ -69,7 +69,7 @@ static void test_wait_three() | |||
go[&]() -> future_t<> | |||
{ | |||
if (co_await event_t::wait_all(std::initializer_list{ evt1, evt2, evt3 })) | |||
if (co_await event_t::wait_all(std::initializer_list<event_t>{ evt1, evt2, evt3 })) | |||
std::cout << "all event signal!" << std::endl; | |||
else | |||
std::cout << "time out!" << std::endl; |
@@ -46,7 +46,7 @@ | |||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | |||
<ConfigurationType>Application</ConfigurationType> | |||
<UseDebugLibraries>false</UseDebugLibraries> | |||
<PlatformToolset>v142</PlatformToolset> | |||
<PlatformToolset>ClangCL</PlatformToolset> | |||
<WholeProgramOptimization>true</WholeProgramOptimization> | |||
<CharacterSet>NotSet</CharacterSet> | |||
</PropertyGroup> |