- 论坛徽章:
- 0
|
O_NDELAY Opens with no delay.
O_NONBLOCK Specifies that the open subroutine should not block.
The O_NDELAY flag and the O_NONBLOCK flag are identical except for the value
returned by the read and write subroutines. These flags mean the process does
not block on the state of an object, but does block on input or output to a
regular file or block device.
刚才测试了一下,以非阻塞方式打开文件,写文件还是以阻塞的方式返回的。代码如下:
fd = open(FILE, O_RDWR | O_NONBLOCK | O_NDELAY);
char * buffer;
buffer = malloc(200 * 1024 * 1024);
write(fd, buffer, size);
有没有其他的什么方法啊,谢谢! |
|