non-blocking and blocking mode
2010-07-26 15:40
417 查看
non-blocking mode指的是不须等待相关的channel,而可以执行其他进程。但blocking mode则是遇到channal无空时,必须停下来等待。
http://www.beedub.com/book/2nd/event.doc.html
By default, I/O channels are blocking. A gets or read will wait until data is available before returning. A puts may also wait if the I/O channel is not ready to accept data. This behavior is OK if you are using disk files, which are essentially always ready. If you use pipelines or network sockets, however, the blocking behavior can hang up your application.
The fconfigure command can set a channel into non-blocking mode. A gets or read command may return immediately with no data. This occurs when there is no data available on a socket or pipeline. A puts to a non-blocking channel will accept all the data and buffer it internally. When the underlying device (i.e., a pipeline or socket) is ready, then Tcl automatically writes out the buffered data. Non-blocking channels are useful so your application can do something else while waiting for the I/O channel. You can also manage several non-blocking I/O channels at once. Non-blocking channels should be used with the fileevent command described earlier. The following command puts a channel into non-blocking mode:
http://www.beedub.com/book/2nd/event.doc.html
By default, I/O channels are blocking. A gets or read will wait until data is available before returning. A puts may also wait if the I/O channel is not ready to accept data. This behavior is OK if you are using disk files, which are essentially always ready. If you use pipelines or network sockets, however, the blocking behavior can hang up your application.
The fconfigure command can set a channel into non-blocking mode. A gets or read command may return immediately with no data. This occurs when there is no data available on a socket or pipeline. A puts to a non-blocking channel will accept all the data and buffer it internally. When the underlying device (i.e., a pipeline or socket) is ready, then Tcl automatically writes out the buffered data. Non-blocking channels are useful so your application can do something else while waiting for the I/O channel. You can also manage several non-blocking I/O channels at once. Non-blocking channels should be used with the fileevent command described earlier. The following command puts a channel into non-blocking mode:
fconfigure fileID -blocking 0
相关文章推荐
- Nonblocking I/O and select()
- 阻塞与非阻塞(blocking and non-blocking)
- SSIS 阻塞,半阻塞和全阻塞 (Non-blocking, semi-blocking and Fully-blocking) transformations清单
- epoll ET mode with tcp nonblocking socket
- ISE错误:“Cannot mix blocking and non blocking assignments on signal ”
- Node(11) Event Driven and Non-blocking
- Asynchronous and non-Blocking I/O 翻译[收藏好文]
- Use Thread Pools Correctly: Keep Tasks Short and Nonblocking
- Mix of blocking and non-blocking assignments to variable <en> is not a recommended coding practice.
- SELECT list is not in GROUP BY clause and contains nonaggregated column this is incompatible with sql_mode=only_full_group_by
- ISE错误:“Cannot mix blocking and non blocking assignments on signal ”
- Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms
- 异步与非阻塞的区别(Difference between asynchronous and non-blocking)
- High Performance Ruby Part 3: non-blocking IO and web application scalability
- Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms
- Java Non-Blocking and Asynchronous IO with NIO & NIO.2 (JSR203) - Reactor/Proactor Implementations
- Blocking/Non-Blocking IO and SYN/ASYN IO
- Verilog HDL 学习笔记2-blocking and non-blocking assignment
- ISE verilog 综合错误提示:ERROR:Xst:880 - "Johnson_source.v" line 45: Cannot mix blocking and non blocking
- verilog behavioral modeling--blocking and nonblocking