- 博客(9)
- 资源 (3)
- 收藏
- 关注
原创 阻塞和非阻塞I/O的手工休眠
1、分配初始化一个wait_queue_t结构,将其加入到对应的等待队列2、设置进程的状态,将其标记为休眠。 TASK_INTERRUPTIBLE、TASK_UNINTERRUPTIBLE3、检查休眠等待条件,调用schedule(),让出CPU例如: 1 static ssize_t xxx_write(struct file *file,const char *b
2013-07-13 10:44:42
598
原创 并发及其管理
在设计自己的驱动程序时,第一个要记住的规则是,只要可能,就应该避免资源的共享。#include //互斥、同步(少)struct semaphore;#include //写者优先,适合写比较少的情况struct rw_semaphore;#include //完成struct completion;#include 自旋锁 spinloc
2013-07-12 15:18:32
899
原创 成功编译QtWeb3.7.5
原创分享,转载注明出处错误1、ushort to wchar mingw32-make.exe[1]: *** No rule to make target `C:\QtSDK\Desktop\Qt\4.7.4\mingw\/src/3rdparty/webkit/Source/WebCore/inspector/front-end/WebKit.qrc', needed by `tmp/
2013-04-20 22:24:07
1331
原创 fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. 的错误
今天在改一个程序的时候遇到这样一个错误fatal error C1189: #error : This file requires _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 or higher is recommended。之后google找了很多,都是在stdafx.h加预处理声明,我仔细看了项目属性,在 配置
2013-04-10 21:35:34
1085
转载 编程中gbk与utf8的转化
在Linux下可以使用iconv.h中的函数,具体去看头文件在windows下实现#include "stdafx.h"#include #include //GBK编码转换到UTF8编码int GBKToUTF8(unsigned char * lpGBKStr,unsigned char * lpUTF8Str,int nUTF8StrLen){ wchar
2013-03-23 15:27:21
843
原创 隐藏HWND窗口的标题栏
LONG lWindowStyle = GetWindowLong(hwnd, GWL_STYLE); lWindowStyle &= ~WS_SYSMENU; //去掉系统菜单 lWindowStyle &= ~WS_CAPTION; //去掉标题栏 SetWindowLong(hwnd, GWL_STYLE, lWindowStyle);
2013-03-23 13:09:49
1893
原创 double free or corruption (!prev):错误
今天遇到这样一个问题 *** glibc detected *** ./cupd: double free or corruption (!prev): 0x093b1208 ***错误出现这个问题的可能原因是1、多次释放同一内存区,需要检查代码,是否出现了对同以内存区释放两次以上的地方。
2013-03-21 19:34:58
17892
原创 Linux下线程与进程同步与互斥
线程同步1. semophore 信号量接口函数int sem_destroy(sem_t *);int sem_getvalue(sem_t *restrict, int *restrict);int sem_init(sem_t *, int, unsigned);int sem_post(sem_t *);int sem_time
2012-10-23 20:27:26
707
原创 XP下QProcess调用一个外部程序无法结束
最近在写的一个QT程序中调用了一个外部程序,在控制该进程时,调用QProcess->kill()无法杀死该进程,也无法结束该进程,去QT手册查了一番,其推荐做法如下: qprocess->terminate(); QTimer::singleShot(1000,temp,
2012-10-23 19:22:53
1163
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人