In the book Hands-on node, the author gives an example of blocking I\O,
var post = db.query("select * from posts where id = 1");
doSomethingWithPost(post)
doSomethingElse();
The author says nothing is executed till line 1 is finished executing db query
And, then he shows non-blocking code
callback = function(post){
doSomethingWithPost(post)
}
db.query("select * from posts where id = 1",callback);
doSomethingElse();
Isn't this also blocking till the query is executed?
So, doSomethingElse won't be executed till query is completed.