摘要:
实现原理图:异步通信关键代码:crucial_codeAPP:signal(SIGIO, my_signal_fun);fcntl(fd, F_SETOWN, getpid());int Oflags = fcntl(fd, F_GETFL);fcntl(fd, F_SETFL, Oflags | FASYNC);DRIVE:static struct fasync_struct *button_fasync;static struct file_operations second_drv_fops = { .fasync = fifth_drv_fasync,}static int f... 阅读全文
posted @ 2012-05-18 21:00
ITMelody
阅读(518)
评论(0)
推荐(0)
摘要:
poll函数 poll函数起源于SVR3,最初局限于流设备。SVR4取消了这种限制,允许poll工作在任何描述字上。poll提供的功能与select类似,不过在处理流设备时,它能够提供额外的信息。 1.#include <poll.h> 2.int poll(struct pollfd *fdarray, unsigned long nfds, int timeout); 3.返回:就绪描述字的个数,0-超时,-1-出错 第一个参数是指向一个结构数组第一个元素的指针。每个数组元素都是一个pollfd结构,用于指定测试某个给定描述字fd的条件。 struct poll... 阅读全文
posted @ 2012-05-18 15:04
ITMelody
阅读(554)
评论(0)
推荐(0)


浙公网安备 33010602011771号