前言 在JDK1.7&1.8源码对比分析[集合]HashMap中我们遗留了一个问题:为什么HashMap在调用resize() 方法时会出现死循环?这篇文章就通过JDK1.7的源码来分析并解释这个问题. 如下,并发场景下使用HashMap造成Race Condition,从而导致死循环,现象是CPU 100%被占用. final HashMap<String, String> map = new HashMap<String, String>(); for (int i =…
主要是挖个坑.候补(代码还没看完..) https://github.com/antirez/redis/tree/5.0 一.Redis保存持久化文件 二.Redis启动加载持久化文件 src/server.c loadDataFromDisk函数 AOF 和 RDB 通过不同的方式加载 /* Function called at startup to load RDB or AOF file in memory. */ void loadDataFromDisk(void) { long l…
上一章我们分析了Scene与Layer相关类的源码,对Cocos2d-x的场景有了初步了解,这章我们来分析一下场景变换TransitionScene源码. 直接看TransitionScene的定义 class CC_DLL TransitionScene : public Scene { public: /** Orientation Type used by some transitions */ enum class Orientation { /// An horizontal orie…