- 博客(18)
- 资源 (10)
- 收藏
- 关注
翻译 无锁循环队列--只适合一读一写两个线程
template<int buflen, typename T> class TLocklessQueue{protected: T BufData[buflen]; int PutIdx; int GetIdx;public: int MaxSize() { return buflen; } int Len() {
2021-11-30 14:20:29
424
原创 星星之火可以燎原
vi ingnore case search \cfind * == find ./ -name ‘*’ ; find * | xargs grep “xxx”CXX_FLAGS=-DNDEBUG in makefile make assert invalid
2021-08-08 18:10:56
102
原创 linux command name
linux command namevi ingnore case search \cdd – data description/disk dump-- convert data filebc – basic/better calculatornm – namesnl – number of linesod – octal dumptr – translateudev – userspace devulimit – user’s limitumask – user’s maskxar
2021-08-08 08:47:34
107
翻译 2.6内核kfifo
2.6内核kfifokfifo.h```c#include <linux/kernel.h>#include <linux/spinlock.h>#include <linux/stddef.h>#include <linux/scatterlist.h>struct __kfifo { unsigned int in; unsigned int out; unsigned int mask; unsigned int esize;
2021-05-22 20:51:46
337
原创 circular buffer
#ifndef _CIRCULAR_BUFFER_H_2021_03_12#define _CIRCULAR_BUFFER_H_2021_03_12#include #include inline bool is_power_of_2(unsigned int v){return v && (!(v & (v - 1)));}inline unsigned int roundup_pow_of_2(unsigned int v){if (v == 0)retur
2021-04-14 22:14:55
204
转载 无锁文章搜集
无锁同步-C++11之Atomic和CAS;如何理解C ++ 11中的std :: atomic :: compare_exchange_weak无锁队列的实现
2021-03-23 09:43:35
81
转载 Scott Meyers:C++史上最重要的五本书籍和五篇技术文章
Scott Meyers:C++史上最重要的五本书籍和五篇技术文章,csdn,lxwde转载链接:https://blog.youkuaiyun.com/njnu_mjn/article/details/38175257
2021-03-22 10:31:28
329
转载 经典永流传2-Lock-Free Code: A False Sense of Security
链接:Lock-Free Code: A False Sense of SecurityTo avoid a race, a lock-free variable must have two key properties that we need to watch for and guarantee: atomicity and orderingcompilers, processors, and caches love to optimize reads and writes, and wi
2021-03-22 10:12:37
144
转载 经典永流传-Exception Handling: A False Sense of Security
Exception Handling: A False Sense of SecurityArgument expressions are fully evaluated before their function is called.v[top–],top在调用拷贝构造返回语句之前已经递减。代码: template T Stack::pop(){ if( top < 0 ) throw ""pop on empty stack""; return v[top--]; /
2021-03-22 09:57:47
268
原创 Performance example source code from Inside the c++ object model(2)
编译环境:gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)例子按4.4节所写:"指向 Member Function之指针"的效率(Pointer-to-Member Efficiency),未包括多继承和虚拟继承float g_cx = 0.f, g_cy = 0.f, g_cz = 0.f;class pt3d{public: float x; float y; float z;public: pt3d(float xx = 0.0,
2021-03-20 13:11:15
104
原创 Performance example source code from Inside the c++ object model
编译环境:gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)例子摘抄自3.5节:对象成员的效率(object member efficiency)constexpr int ITERATION_COUNT = 10000001;void test_plain_double(){ START_TIMING(0); float pA_x = 1.725, pA_y = 0.875, pA_z = 0.478; float pB_x = 0.315, pB
2021-03-18 16:25:42
126
翻译 A predicate for stl algorithm should always be stateless
A predicate for stl algorithm should always be statelessvoid test_remove_if_bug(){ list<int> coll = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; PRINT_ELEMENTS(coll, "coll: "); // remove third element list<int>::iterator pos; int n = 3; int
2021-03-06 13:31:23
109
翻译 Dimensional Analysis in C++ by Template
template <int m, // exponent for mass int d, // exponent for distance int t> // exponent for timeclass Units{public: explicit Units(double initVal = 0) : val(initVal) {} double value() const { return val; } double &value() { return
2021-03-04 15:21:56
176
1
翻译 Instruction_level_parallelism
Instruction_level_parallelismvoid Instruction_level_parallelism(){ unsigned int steps = 1 * 1024 * 1024 * 1024u - 1; cout << steps << endl; int *a = new int[2]; time_t begin = time(nullptr); // Loop 1 for (unsigned int i = 0; i < ste
2021-03-04 14:18:56
250
1
dbx调试教程,英文版
2014-03-02
(中英文)-POSIX多线程程序设计-Programming with POSIX Threads
2012-10-05
design pattern Gof
2012-01-13
Beyond the C++ Standard Library: An Introduction to Boost
2012-01-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人