What is the difference between a blocking and non-blocking read?

后端 未结 4 913
醉话见心
醉话见心 2020-12-16 05:26

Add to the above question the concept of a wait/no wait indicator as a parameter to a ReadMessage function in a TCP/IP or UDP environment.

A third party function de

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-16 05:51

    An analogy if you'll permit me - sorry, it's late in the afternoon and I'm in the mood, if it gets down voted - ah well...

    You want to get into a snazzy nightclub, but the bouncer tells you you cannot go in till someone comes out. You are effectively "blocked" on that condition. When someone comes out, you are free to go in - or some error condition such as "are those trainers?" Your night doesn't really kick off till you get in, your enjoyment is "blocked".

    In a "non-blocking" scenario, you will tell the bouncer your phone number, and he will call you back when there is a free slot. So now you can do something else while waiting for someone to come out, you can start your night somewhere else and come back when called and continue there...

    Sorry if that didn't help...

提交回复
热议问题