echobfy

博客园 首页 新随笔 联系 订阅 管理

2016年3月13日 #

摘要: Python中的threading RLock——重入锁 RLock在Python中的实现是对Lock的封装,具体在类中维护了一个重入次数的变量。一旦一个线程获得一个RLock,该线程再次要求获得该锁时不会阻塞,但该线程获得多少次该锁,则必须释放多少次。一个重入锁必须由获得该锁的线程释放。 源码实现 阅读全文
posted @ 2016-03-13 22:34 小白哥哥啊 阅读(2287) 评论(0) 推荐(0) 编辑

2016年1月31日 #

摘要: `SyncRequestProcessor ZooKeeperCriticalThread`),是ZooKeeper请求处理链中的事务日志记录处理器,其主要用来将事务请求记录到事务日志文件中去,同时还会触发ZooKeeper进行数据快照。 数据结构 :上一个 调用 将request排入该队列中等待处 阅读全文
posted @ 2016-01-31 21:43 小白哥哥啊 阅读(543) 评论(0) 推荐(0) 编辑

2015年12月11日 #

摘要: 参考: "http://stackoverflow.com/questions/17246693/what exactly is the difference between shallow copy deepcopy and normal assignm" 正常赋值语句会使左操作数简单地指向... 阅读全文
posted @ 2015-12-11 20:10 小白哥哥啊 阅读(301) 评论(0) 推荐(0) 编辑

2015年7月11日 #

摘要: 基本概念线程与任务的概念不一样。任务:通常是一些抽象的且离散的工作单元,比如在Web请求中,针对用户的请求需要返回相应的页面是一个任务,在Java中实现Runnable接口的类也是一个任务.线程:执行任务的实体,可以在单个线程中串行地执行各项任务,例如单线程串行执行Web请求,也可以在为每个请求建立... 阅读全文
posted @ 2015-07-11 16:09 小白哥哥啊 阅读(204) 评论(0) 推荐(0) 编辑

2015年3月7日 #

摘要: 转载自:http://dev.yesky.com/436/7581936.shtml 在Java语言中, abstract class 和interface是支持抽象类定义的两种机制。正是由于这两种机制的存在,才赋予了Java强大的 面向对象能力。abstract class和interfac... 阅读全文
posted @ 2015-03-07 13:48 小白哥哥啊 阅读(186) 评论(0) 推荐(0) 编辑

2014年7月18日 #

摘要: 最近学Python,老是被编码的问题搞得晕乎乎的,晚上看了好多篇博客,整理出来一个比较清晰的关于几种编码以及字符集的思路。主要参考:http://blog.sina.com.cn/s/blog_6dd65c6f01019b37.html http://blog.csdn.net/zhoub... 阅读全文
posted @ 2014-07-18 21:41 小白哥哥啊 阅读(6423) 评论(1) 推荐(5) 编辑

2014年7月17日 #

摘要: 以前使用Linux老是会不小心按下Ctrl + z,然后就出现看不懂的情况,以为程序突然就没了,今天专门研究了下Linux下的几个快捷键和工作管理。其中找到一篇很不错的文章,大部分是里面转载的。原文地址:http://blog.chinaunix.net/uid-26495963-id-306275... 阅读全文
posted @ 2014-07-17 16:54 小白哥哥啊 阅读(3949) 评论(0) 推荐(0) 编辑

2014年3月2日 #

摘要: 排序题#include #include #include #include #include using namespace std;const int N = 100005;int score[10];struct Node{ int id; int problem; int get;}person[N];struct ANS{ int rank; int id; int total; int get[6]; bool flag; int perfect;}ans[10005];int cmp1(const ANS &a, const ANS &b){ if (a.tota 阅读全文
posted @ 2014-03-02 15:05 小白哥哥啊 阅读(289) 评论(0) 推荐(0) 编辑

摘要: BFS,题意比较难懂,是求离query L层的总共人数#include #include #include #include #include #include #include using namespace std;const int N = 1005;struct E{ int node;};vector v[N];int mark[N];void add_edge(int a, int b){ E tmp; tmp.node = b; v[a].push_back(tmp);}struct ANS{ int num; int lev;};void BFS(int x, int ll){ 阅读全文
posted @ 2014-03-02 15:03 小白哥哥啊 阅读(438) 评论(0) 推荐(0) 编辑

摘要: 模拟题,注意当k == 1 与 k == n时情况#include #include #include #include #include using namespace std;const int N = 100005;struct Node{ int pre; int value; int lat;}node[N];int order[N];int size;map pre2idx;void solve1(int fir, int n){ map::iterator it = pre2idx.find(fir); order[size++] = it->second; while ( 阅读全文
posted @ 2014-03-02 15:00 小白哥哥啊 阅读(606) 评论(8) 推荐(0) 编辑