下面的类似的源码在MSVC上能正确编译通过。但是gcc/g++上就会错:1. if(expr)2. goto error;3. size_t var = 0;4.error:5 error_handle();4:1: error: jump to label ‘error’ [-fper...
分类:
其他好文 时间:
2014-11-11 18:42:51
阅读次数:
218
异步服务端中的多线程
我在第4章 客户端和服务端展示的异步服务端是单线程的,所有的事情都发生在main()中:
int main() {
talk_to_client::ptr client = talk_to_client::new_();
acc.async_accept(client->sock(), boost::bind(handle_
accept,client,_1));
service.run();
}
异步的美妙之处就在于把单线程变为多线程的简单。你可...
分类:
编程语言 时间:
2014-11-11 10:50:49
阅读次数:
281
一函数原型及参数 function MessageBox(hWnd: HWND; Text, Caption: PChar; Type: Word): Integer; hWnd:对话框父窗口句柄,对话框显示在Delphi窗体内,可使用窗体的Handle属性,否则可用0,使其直接作为桌面窗口的子窗口...
分类:
编程语言 时间:
2014-11-10 09:45:35
阅读次数:
192
一、通用函数:colorbar显示彩色条语法:colorbar \ colorbar('vert') \ colorbar('horiz') \ colorbar(h) \ h=colorbar(...) \ colorbar(...,'peer',axes_handle)getimage 从坐标轴...
分类:
其他好文 时间:
2014-11-08 00:38:14
阅读次数:
476
Here is what i encountered: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=me.waye.intentdemo.intent.action.WAYE_ACTION cat=[me.waye.intentdemo.intent.category....
分类:
移动开发 时间:
2014-11-07 13:17:23
阅读次数:
238
A dental wedge has a handle portion attached to the dental wedge portion for use in separating teeth. The handle portion facilitates positioning and i...
分类:
其他好文 时间:
2014-11-07 12:43:24
阅读次数:
166
1 HANDLE hProcessSnap; 2 PROCESSENTRY32 pe32; 3 BOOL bProcess; 4 int p =0; 5 i = 0; 6 for (p=0;p<130;p++) { 7 Co...
分类:
其他好文 时间:
2014-11-06 12:29:54
阅读次数:
134
线程的远程注入要实现线程的远程注入必须使用Windows提供的CreateRemoteThread函数来创建一个远程线程该函数的原型如下:HANDLE CreateRemoteThread( HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttribu...
分类:
系统相关 时间:
2014-11-06 07:04:51
阅读次数:
339
在看《Cplusplus Concurrency in Action Practical Multithreading》。记录一下学习过程,这是第四章开始,关于等待一次性事件。...
分类:
其他好文 时间:
2014-11-05 21:35:29
阅读次数:
264
/**
* author:hasen
* 参考:《linux设备驱动开发详解》
*/
1、并发与竞态
并发(concurrency)指的是多个执行单元同时、并行被执行,而并发的执行单元对共享资源(软件上的全局变量,静态变量等)的访问则很容易导致竞态(race conditions).
主要的竞态发生在以下几种情况:
(1)对称多处理(SMP)的多个CPU
(2)单CPU内进程...
分类:
系统相关 时间:
2014-11-04 17:33:43
阅读次数:
202