Browse Source

兼容gcc 10

tags/2.9.10
tearshark 4 years ago
parent
commit
92af05226c
2 changed files with 16 additions and 12 deletions
  1. 6
    2
      README.md
  2. 10
    10
      tutorial/test_async_mutex.cpp

+ 6
- 2
README.md View File

# librf 2.9.7
# librf 2.9.8


### librf - 协程库 ### librf - 协程库
* librf是一个基于C++ Coroutines提案 ‘Stackless Resumable Functions’编写的非对称stackless协程库。 * librf是一个基于C++ Coroutines提案 ‘Stackless Resumable Functions’编写的非对称stackless协程库。


支持以下平台和编译器: 支持以下平台和编译器:


Windows: 使用VS2017/VS2019/clang 9编译
Windows: 使用VS2017/VS2019/clang 9 编译
Android: 使用NDK 20.1 自带的clang编译 Android: 使用NDK 20.1 自带的clang编译
Mac: 使用XCode 11.2.1 自带的apple-clang编译 Mac: 使用XCode 11.2.1 自带的apple-clang编译
Ubuntu: 使用GCC 10.0.1编译(2020-04-18:mutex ranged lock failed)
注意:GCC 10.0.1在C++ Coroutines上存在很多BUG,并且缺少对应的头文件。
当前阶段不推荐使用。


librf有以下特点: librf有以下特点:



+ 10
- 10
tutorial/test_async_mutex.cpp View File

assert(c.is_locked()); assert(c.is_locked());
++g_counter; ++g_counter;
//std::cout << "push:" << g_counter << " on " << idx << std::endl;
//co_await 5ms;
std::cout << "push:" << g_counter << " on " << idx << std::endl;
co_await 5ms;
} }
} }
assert(c.is_locked()); assert(c.is_locked());
--g_counter; --g_counter;
//std::cout << "pop :" << g_counter << " on " << idx << std::endl;
//co_await 5ms;
std::cout << "pop :" << g_counter << " on " << idx << std::endl;
co_await 5ms;
} }
} }
void resumable_main_mutex() void resumable_main_mutex()
{ {
std::cout << "begin resumable_mutex_synch()" << std::endl;
resumable_mutex_synch();
std::cout << std::endl;
//std::cout << "begin resumable_mutex_synch()" << std::endl;
//resumable_mutex_synch();
//std::cout << std::endl;
std::cout << "begin resumable_mutex_async()" << std::endl;
resumable_mutex_async();
std::cout << std::endl;
//std::cout << "begin resumable_mutex_async()" << std::endl;
//resumable_mutex_async();
//std::cout << std::endl;
std::cout << "begin resumable_mutex_lock_range()" << std::endl; std::cout << "begin resumable_mutex_lock_range()" << std::endl;
resumable_mutex_lock_range(); resumable_mutex_lock_range();

Loading…
Cancel
Save