问题描述
向TCP / IP或UDP环境中的ReadMessage函数的等待/无等待指示符的参数的概念添加上述问题。此第三方函数描述说明:此函数用于从由输入调用的先前寄存器定义的队列中读取消息。输入等待/无等待指示器将确定该功能。将在指定的队列上阻塞(这意味着什么),等待将数据放在队列上。
如果指定了nowait选项且没有可用的数据,则NULL指针将返回给调用者。当数据可用时,此函数将返回指向从队列中读取的数据的指针。
Add to the above question the concept of wait /no wait indicator as a parameter to a ReadMessage function in a TCP/IP or UDP environment. This third party function description states that: This function is used to read a message from a queue which was defined by a previous registerforinput call. The input wait/no wait indicator will detrmine if this funct. will block (what does this mean???) on the queue specified, waiting for the data to be placed on the queue.If nowait option is specified and no data is available a NULL pointer will be returned to the caller. When data available this function will return a pointer to the data read from the queue.
推荐答案
阻塞意味着执行代码在该线程中)将在调用期间停止。基本上,函数调用将不会返回,直到阻塞操作完成。
Blocking means that execution of your code (in that thread) will stop for the duration of the call. Essentially, the function call will not return until the blocking operation is complete.
阻塞读取将等待,直到有可用的数据(或超时,如果有) ,然后从函数调用返回。非阻塞读取将(或至少应该)始终立即返回,但如果目前没有可用的数据,则可能不返回任何数据。
A blocking read will wait until there is data available (or a timeout, if any, expires), and then returns from the function call. A non-blocking read will (or at least should) always return immediately, but it might not return any data, if none is available at the moment.
这篇关于阻塞读和非阻塞读的定义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!