absl教程(五):Synchronization library
#include
#include
#include
using namespace std;
// GUARDED_BY LOCKS_EXCLUDED EXCLUSIVE_LOCKS_REQUIRED
mutex mu;
int f() EXCLUSIVE_LOCKS_REQUIRED(mu) {
}
int (*lambda)(int, int) = [](int a,int b) -> int EXCLUSIVE_LOCKS_REQUIRED(mu) {return a+b;};
int main(){
cout << lambda(1,7) << endl;
}
cmake_minimum_required(VERSION 3.5.1)
project(demo)
#set(CMAKE_C_COMPILER clang)
#set(CMAKE_CXX_COMPILER clang++)
#add_compile_options(-Wthread-safety)
set(LINK_FLAGS "-rdynamic -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now")
set(CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${LINK_FLAGS}")
set(CMAKE_CXX_STANDARD 17)
# 1. 查找依赖。
#find_package(Ceres REQUIRED)
# 2. 设置包含目录和库目录。
#include_directories(
# ${CERES_INCLUDE_DIRS}
#)
# 3. 生成可执行程序。
add_executable(main
main.cc
)
#target_link_libraries(main
# ${CERES_LIBRARIES}
#)
# cmake -G "MinGW Makefiles" ..
https://www.exyb.cn/news/show-46109.html?action=onClick