问题:
在使用线程池处理客户端请求时发现不能获取到客户端的ip!
原因:
由于在server_loop注循环中只把连接字sock加到queue队列中,并没有客户端IP,所以每一次queue回调函数只能取得sock连接字,没有客户端的ip
解决方法:
在将sock加入queue队列的同时把ip也加入到ips队列中,ips队列的长度和queue相同,而且存的数据下标要...
分类:
编程语言 时间:
2015-01-24 15:56:49
阅读次数:
290
下面的两个SQL是等价的,但是一个执行N小时都执行不完,一个花了一分钟。执行计划显示第一个语句是由外面的即将被更新的表驱动内层,相对于是一个NEST LOOP,cost非常大。第二个语句是内层单独执行完后,与外面的筛选结果做一个HASH JOIN, cost降低了很多.UPDATE GPCOMP1....
分类:
其他好文 时间:
2015-01-23 17:38:41
阅读次数:
256
http://my.oschina.net/astute/blog/119250?p=1在看ranch user guide的过程中,发现实现protocol handler需要使用特殊的gen_server形式,也就是enter_loop函数调用,事例代码如下:?12345678910111213...
分类:
其他好文 时间:
2015-01-23 12:42:09
阅读次数:
362
Is a loop ? Question descrip as follows :
Assume that wehave a head pointer to a link-list. Also assumethat we know the list is single-linked. Can you come up an algorithm to checkwhether this link list includes a loop by using O(n) time and O(1) ...
分类:
其他好文 时间:
2015-01-22 13:28:16
阅读次数:
229
#### 两个例子1.GUI event loop```while (running){ // 从事件队列里获取一个事件 Event event = getNextEvent(); // Handle event...}```2.Central event bus 不同系统公用的通信中心...
分类:
其他好文 时间:
2015-01-21 14:51:22
阅读次数:
186
测试代码:
Duration:
currentTime:
var element_d = document.getElementById("d");
var element_c = document.getElementById("c");
var A = new Audio("test.mp3");
A.loop=true;
A.ondurationchange=function(){...
让我们用字母B来表示“百”、字母S表示“十”,用“12...n”来表示个位数字n( 2 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 3 4 ....
分类:
其他好文 时间:
2015-01-20 11:52:33
阅读次数:
197
{pc:content action="position" posid="14" catid="13,14,15,16,17,18,19,20,21"order="listorder DESC"start="0" num="1" return="data"}{loop $data $key $r}{...
分类:
Web程序 时间:
2015-01-19 20:51:59
阅读次数:
147
在上一篇文章(http://www.cnblogs.com/coding-my-life/p/4220128.html)中,提到了libev提供了处理信号的C++ wrap。但我显然接受不了需要进入libev的事件循环(event loop)后才能捕捉到消息的缺点。于是决定依照libev的思路自.....
分类:
编程语言 时间:
2015-01-17 22:07:16
阅读次数:
318
之前看了一篇关于EventLoop的文章做了下面的笔记EventLoop是解决JavaScript单线程问题的一种运行机制当程序接受到了请求之后.就会把请求交给EventLoop然后继续往下执行这样就不用等待请求返回,继续执行下面的代码,当EventLoop完成后会把结果返回给程序程序再调用已经设定...
分类:
其他好文 时间:
2015-01-17 11:12:57
阅读次数:
141