3 ms·
Usually when people refer to something as blocking / non-blocking they mean I/O bound tasks not CPU-bound. Something like a while loop blocking is surely to be
by jayflux 9y ago
Usually when people refer to something as blocking / non-blocking they mean I/O bound tasks not CPU-bound.
Something like a while loop blocking is surely to be expected?
Many would argue this is not an example of a blocking call. A good example would be writing/reading from localStorage (as some browsers won't return until its written to physical storage i.e the HDD)
- baron816 9y agoWell, a novice coder wouldn't know that. The end behavior isn't going to be any different than writing to localStorage (nothing can run until it's done), right? And you very well could move that code to a different thread via a web worker, couldn't you? So if it walks like a duck, and it blocks like a duck...
- jayflux 9y ago> Well, a novice coder wouldn't know that Yup, I know, that's why I gave an explanation :) > And you very well could move that code to a different thread via a web worker, couldn't you? localStorage is not thread safe, so no probably not.