FlexClasscom/brenoguim/flexclassstd::make_shared(n) std::shared_ptr (block) Control Block T T T T T …my::shared_ptr Control Block T T T T T T … int ref_cnt; int size; my::shared_ptr (block)I will auto my::make_shared(int n) { // Allocate sizeof(controlBlock) + n*sizeof(T) bytes // Cast and initialize the control block // Cast and initialize each T // return my::shared_ptr (block); fc::AdjacentArray data; }; template auto my::make_shared(int n) { Block * block = fc::make >(n) // return my::shared_ptr (block); } (n, 0); https://godbolt.org/z/v3hdhYnaT 0 码力 | 8 页 | 957.56 KB | 6 月前3
Lock-Free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!shared_ptrnext; }; atomic > head; void push_front(T t) { auto p = make_shared (std::move(t), head.load()); while (!head.compare_exchange_weak(p->next, p)) {} atomic ref_count = 1; … T atomic > a Thread 1 auto s = a.load(); Thread 2 a.store(make_shared ( …)); ++ -- If this happens first…23 The fundamental problem: The race to zero Thread 1 compare_exchange(old_ccb , new_ccb)) if (old_ccb.ctrl != prev_ccb.ctrl) { // A store must have moved my local count to the global count } } The store operation helps an in- flight load by moving 0 码力 | 45 页 | 5.12 MB | 6 月前3
whats new in visual studio⌛ ; Clang/LLVM ⌛ ☑️�Stepping ☑️�Parallel Stacks ☑️�Debugger visualizers (.natvis) ☑️�Just My Code debugging Demo C++20 in action Thu, Oct 28 – 10:30am C++20’sCalendars and Time IntelliSense in CMake projects targeting Android or embedded • Improve IntelliSense tooltip for make_shared/make_unique/emplace_back/etc • Implement the equivalent of Wmissing-braces • Update the bundled 0 码力 | 42 页 | 19.02 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - Zeno 中的现代 C++ 最佳实践 作为纯虚函数,然后让猫和狗分别实现他 clone 的调用 • 这样一来,我们通用的 eatTwice 函数里 只需调用 obj->clone() ,就等价于调用了 相应的猫或是狗的 make_shared(*obj) ,这就实现了拷 贝的多态。 如何批量定义 clone 函数? • 可以定义一个宏 IOBJECT_DEFINE_CLONE ,其内容是 clone 的实现。这里我们用 然后在这个 IObjectClone 里实现 clone 即可。那为什么需要派生类作为模板参数 ? • 因为 shared_ptr 的深拷贝需要知道对象具 体的类型。注意这里不仅 make_shared 的参数有 Derived , this 指针(原本是 IObjectClone const * 类型)也需要转化成 Derived 的指针才能调用 Derived 的拷贝 构造函数 0 码力 | 54 页 | 3.94 MB | 1 年前3
C++20 STL Features: 1 Year of Development on GitHubAdamBucior •(bit_cast, rotating/counting, power-of-2) • Several PRs by barcharcraz • make_shared() For Arrays • GH-309 by AdamBucior, tested by Weheineman • midpoint(), lerp() • Paolo Torres 0 码力 | 45 页 | 702.09 KB | 6 月前3
C++20: An (Almost) Complete Overviewauto front() const { return reference(head); } void push_front(T t) { auto p = make_shared(); p->t = t; p->next = head; while (!head.compare_exchange_weak(p->next, p)){ 0 码力 | 85 页 | 512.18 KB | 6 月前3
谈谈MYSQL那点事或 或 InnoDB InnoDB 不同引擎进行不同定制 不同引擎进行不同定制 性配置 性配置 针对不同的应用情况进行合理配置 针对不同的应用情况进行合理配置 针对 针对 my.cnf my.cnf 进行配置,后面设置是针对内存为 进行配置,后面设置是针对内存为 16G 16G 的服务器进行的合理设置 的服务器进行的合理设置 服务优化 服务优化 MySQL MySQL 配置原则 来查看当前 MySQL MySQL 服务器线 服务器线 程 程 执行情况,是否锁表,查看相应的 执行情况,是否锁表,查看相应的 SQL SQL 语句 语句 设置 设置 my.cnf my.cnf 中的 中的 long-query-time long-query-time 和 和 log-slow-queries log-slow-queries 能 能 够 够 mysqlsla - hackmysql.com mysqlsla - hackmysql.com 推出的一款日志分析工具 推出的一款日志分析工具 ,功能 ,功能 非常强大 非常强大 my sql-ex plain-slow -log – – 德国工程师使用 德国工程师使用 Perl Perl 开发的把 开发的把 Slow Log Slow Log 输出到屏幕,功能简单0 码力 | 38 页 | 2.04 MB | 1 年前3
Learning by Contributing to Rust Compiler - 陈于康Cryptape Rust My work experience • Strongly interested in programming languages implementation • My solutions to EOPL My experience • 2014 ~ 2018 Some small projects More open-source projects, gomoku, youki, dapr-wasm • 2022 ~ Regular contributions to Rust My Rust experience • A real case Remove duplicated diagnostics • Issue #100000, Rust is beautiful0 码力 | 23 页 | 3.28 MB | 1 年前3
唐刚 - Use Rust to Develop the Decentralized Open Data Application - RustChinaConf2023Core Difference Between ODA and Web3 DApp ➔If I opened my database to others, how would I get profits from my efforts, how should I run my business? ➔How to attract more parties to run steady and0 码力 | 30 页 | 2.53 MB | 1 年前3
C++高性能并行编程与优化 - 课件 - 01 学 C++ 从 CMake 学起# 添加要链接的库 • target_add_definitions(myapp PUBLIC MY_MACRO=1) # 添加一个宏定义 • target_add_definitions(myapp PUBLIC -DMY_MACRO=1) # 与 MY_MACRO=1 等价 • target_compile_options(myapp PUBLIC # 添加头文件搜索目录 • link_directories(/opt/cuda) # 添加库文件的搜索路径 • add_definitions(MY_MACRO=1) # 添加一个宏定义 • add_compile_options(-fopenmp) # 添加编译器命令行选项 第三方库 - 作为纯头文件引入0 码力 | 32 页 | 11.40 MB | 1 年前3
共 15 条
- 1
- 2













