Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 5 months ago.
What's the difference between read and readnb, send and sendnb? When to use them?
I'm confused.. what does non-blocking unblock ?
2 Answers
11 years, 5 months ago.
It is handy to link the library you mean...
From the tags I guess you mean USB HID device. Not used it myself, but in general it works pretty much the same: If there is data to read, read and read_nb do the same, they return that data. If not, read_nb will return directly that there was no data to read, while read blocks until there is data.
Sendis pretty much the same, only then related to the output buffer. If the output buffer is empty, both will simply put the data in it and return. If it is full, non-blocking will tell there is no space, while blocking will wait until there is space.