Modern CMake
但凡有点历史的东西,在演进到一个新的阶段时,总会总结一套新的 practices 然后冠之以 modern,例如 modern C++,还有今天的主题 —— modern CMake。
上周花了一点时间稍微研究了一下所谓的 modern cmake,然后将 KBase 在 POSIX 上的 cmake 文件都按照 modern cmake 的做法做了修改,结果可见此
但凡有点历史的东西,在演进到一个新的阶段时,总会总结一套新的 practices 然后冠之以 modern,例如 modern C++,还有今天的主题 —— modern CMake。
上周花了一点时间稍微研究了一下所谓的 modern cmake,然后将 KBase 在 POSIX 上的 cmake 文件都按照 modern cmake 的做法做了修改,结果可见此
Go is a quite awesome programming language for building network applications. So I built my own HTTP proxy server using go last week.
To grasp the essence of how HTTP proxy server works, I choosed to implement it on TCP transport layer, forwarding TCP traffic directly.
Essentially, it runs a server, accepting incoming TCP connections and from which the server extracts target host of a request by parsing HTTP protocol messages. The server then establishes a connection to the target host, and finally operates as an intermedia, forwarding traffic from one host to another.
Implementing a TCP server which is able to handle concurrent requests uing go is easier than you thought: just runs a loop to accept requests, launching a new goroutine for each new connection:
1 | type Server struct { |
当前行业招聘的不靠谱,招揽优秀人员的难度大。
脱颖而出的核心:良好的阅读习惯 + Github 项目
这里说的两年是针对应届生来说的,对于已经工作的人来说,可以当作是虚指。
不过文中提到的,拥抱变化的三个核心点:
颇有道理。
如何做技术选型
A brief introduction to Linux I/O stack.
这篇 post 的质量在国内技术博客里算是少有的干货。
另,关于 page cache 和 buffer cache 的最新的内容,可以参考 Robert Love 在 quora 上的一个回答
CppCon 2015: John Farrier “Demystifying Floating Point”
工程实践上使用浮点数(IEEE-754)需要注意的一些坑。
看之前最好翻一下 CSAPP 中关于浮点数 IEEE-754 模型的基础知识
Why on the earth do we need thread-pool? The answer is obvious: for doing jobs behind the scenes.
That is, saying, you have a constant stream of incoming tasks to complete, and most of which either incur heavy computation or invovle device I/O, you definitely don’t want to execute them on your main thread, because it will block your main thread until the job is done, making your application less responsive.
However, with thread-pool, you can simply submit a task to the pool, then continue what was doing; the task will eventually be completed on a thread of the thread-pool.
If your processor has multiple cores, the task is possibly performed concurrently with your jobs on the main thread.
Before we switch our focus to editor, we are better to think twice about what we can do with the thread-pool we will build.
序言请移步此处
MSVC STL 的分析版本请移步此处
Libstdc++ 的分析版本请移步此处
Boost 的分析版本请移步此处
注 1:因为这不是第一篇分析,所以会直入主题,跳过文学写作常用的累赘的过渡。
注 2:这是系列最后一篇。
Chromium tag 68.0.3421.1
代码位置:base/memory/ref_counted.{h, cc}
两个类实现了非线程安全的引用计数,即:内部计数使用的是 built-in integer
先看看 RefCountedBase
的大致结构:
1 | class RefCountedBase { |
可以看出核心 ref_count_
类型是 uint32_t
ctor 和 dtor 都被定义为 protected,说明这类使用做基类;同时提供了 AddRef()
和 Release()
,进行内部的计数增减。
序言请移步此处
MSVC STL 的分析版本请移步此处
Libstdc++ 的分析版本请移步此处
注:因为这不是第一篇分析,所以会直入主题,跳过文学写作常用的累赘的过渡。
选用最新的 Boost 1.67 作为研究目标
在开始正题前,先简单看一下 shared_ptr
的类成员,方便后续分析:
1 | namespace detail { |