Blocking mode I/O blocks the issuing thread until the operation transfers at least one byte or an error or end of stream occurs. Blocking algorithms refer to an operation in multithreaded environment which temporarily restricts access to some resources to a single thread, thus blocking all other ones. It isn't clear which this tag is intended for.
Questions tagged [blocking]
1679 questions
483
votes
16 answers
asynchronous and non-blocking calls? also between blocking and synchronous
What is the difference between asynchronous and non-blocking calls? Also between blocking and synchronous calls (with examples please)?

user331561
- 4,921
- 3
- 16
- 5
209
votes
6 answers
How efficient is locking and unlocked mutex? What is the cost of a mutex?
In a low level language (C, C++ or whatever): I have the choice in between either having a bunch of mutexes (like what pthread gives me or whatever the native system library provides) or a single one for an object.
How efficient is it to lock a…

Albert
- 65,406
- 61
- 242
- 386
144
votes
9 answers
Is non-blocking I/O really faster than multi-threaded blocking I/O? How?
I searched the web on some technical details about blocking I/O and non blocking I/O and I found several people stating that non-blocking I/O would be faster than blocking I/O. For example in this document.
If I use blocking I/O, then of course the…

yankee
- 38,872
- 15
- 103
- 162
98
votes
5 answers
What's the difference between: Asynchronous, Non-Blocking, Event-Base architectures?
What's the difference between:
Asynchronous,
Non-Blocking, and
Event-base architectures?
Can something be both asynchronous and non-blocking (and event-based)?
What's most important in programming, to have something: asynchronous, non-blocking…

nickb
- 9,140
- 11
- 39
- 48
78
votes
12 answers
Polling the keyboard (detect a keypress) in python
How can I poll the keyboard from a console python app? Specifically, I would like to do something akin to this in the midst of a lot of other I/O activities (socket selects, serial port access, etc.):
while True:
# doing amazing pythonic…

K. Brafford
- 3,755
- 2
- 26
- 30
74
votes
7 answers
How would you implement a basic event-loop?
If you have worked with gui toolkits, you know that there is a event-loop/main-loop that should be executed after everything is done, and that will keep the application alive and responsive to different events. For example, for Qt, you would do…

fengshaun
- 2,100
- 1
- 16
- 25
73
votes
13 answers
How to create a sleep/delay in nodejs that is Blocking?
I'm currently trying to learn nodejs and a small project I'm working is writing an API to control some networked LED lights.
The microprocessor controlling the LEDs has a processing delay, and I need to space commands sent to the micro at least…

on3al
- 2,090
- 4
- 20
- 19
68
votes
2 answers
What is NSManagedObjectContext's performBlock: used for?
In iOS 5, NSManagedObjectContext has a couple of new methods, performBlock: and performBlockAndWait:. What are these methods actually used for? What do they replace in older versions? What kind of blocks are supposed to be passed to them? How do I…

nevan king
- 112,709
- 45
- 203
- 241
66
votes
2 answers
What does InputStream.available() do in Java?
What does InputStream.available() do in Java? I read the documentation, but I still cannot make it out.
The doc says:
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a…

Albus Dumbledore
- 12,368
- 23
- 64
- 105
59
votes
7 answers
Java InputStream blocking read
According to the java api, the InputStream.read() is described as:
If no byte is available because the
end of the stream has been reached,
the value -1 is returned. This method
blocks until input data is available,
the end of the stream is…

jbu
- 15,831
- 29
- 82
- 105
59
votes
2 answers
Blocking IO vs non-blocking IO; looking for good articles
Once upon a time I bumped into Introduction to Indy article and can't stop thinking about blocking vs non-blocking IO ever since then.
Looking for some good articles describing what are pros and cons of blocking IO and non-blocking IO and how to…

Piotr Dobrogost
- 41,292
- 40
- 236
- 366
56
votes
27 answers
How to prevent downloading images and video files from my website?
How to prevent downloading images and video files from my website? Is it possible?
What would be the best way to do this?

Haim Evgi
- 123,187
- 45
- 217
- 223
51
votes
7 answers
Wrapping an asynchronous computation into a synchronous (blocking) computation
similar questions:
Pattern for wrapping an Asynchronous JavaScript function to make it synchronous
Wrapping an asynchronous method synchronously in C#
I have an object with a method I would like to expose to library clients (especially scripting…

Jason S
- 184,598
- 164
- 608
- 970
49
votes
5 answers
In Go, does it make sense to write non-blocking code?
coming from node.js point of view, where all code is non-blocking.
In Go, non-blocking is easily achieved using channels.
if one were writing a node.js type server in go, does it make sense to make it non-blocking? for example, having a database…

cc young
- 18,939
- 31
- 90
- 148
47
votes
3 answers
Chrome blocking javascript on localhost
I'm working on developing a site on my local machine (Windows 7 Ultimate x64) using WAMP, running APACHE v2.2.22, PHP 5.3.13, and MySQL v5.5.24. I'm developing using Chrome v 22.0.1229.94. I've got quite a bit of javascript in the site, however, and…

braican
- 2,172
- 1
- 18
- 16