Questions tagged [nonblocking]

Non-blocking mode I/O either transfers at least one byte or returns immediately with an error or end of stream. Non-blocking algorithms refer to use of concurrency without the usual mutual exclusion primitives, guaranteeing that thread operations will not block indefinitely. This is usually handled with atomic value modification (increment/decrement) and/or reading (compare-and-exchange) operations.. It isn't clear which this tag is intended for.

1597 questions
18
votes
3 answers

EINTR and non-blocking calls

As is known, some blocking calls like read and write would return -1 and set errno to EINTR, and we need handle this. My question is: Does this apply for non-blocking calls, e.g, set socket to O_NONBLOCK? Since some articles and sources I have read…
haohaolee
  • 677
  • 1
  • 9
  • 16
18
votes
1 answer

How is Non-Blocking IO implemented?

In Java or C# or some other languages, there are non-blocking IO facilities, e.g., for sockets. So I can give my callback functions to the non-blocking IO and once the non-blocking IO receives anything, it will call my callbacks. I am wondering how…
Jack
  • 3,913
  • 8
  • 41
  • 66
17
votes
2 answers

How to write to a file using non blocking IO?

I want to write to a file using a non-blocking method in Python. On some googling, I found that the language supports fcntl in order to do so, but the method to implement the same is not very clear to me. This is the code snippet (I don't know…
Rahul
  • 11,129
  • 17
  • 63
  • 76
17
votes
6 answers

What are some architectural reasons to use node.js aside from scalability?

The most common theme I read about why to use node.js is for high scalability due to it's evented, non-blocking I/O model. I'm trying to understand other non-scalability uses cases (and aside from being used as a general server-side javascript…
Howiecamp
  • 2,981
  • 6
  • 38
  • 59
17
votes
1 answer

Spring WebFlux WebClient resilience and performance

I just test by sample PoC project some blocking / non blocking solutions in simple common scenario. Scenario: There are rest blocking endpoint which is quite slow - each request tooks 200 ms. There are other - client application, which call this…
17
votes
7 answers

Is there a Push-based/Non-blocking XML Parser for Java?

I'm looking for an XML parser that instead of parsing from an InputStream or InputSource will instead allow blocks of text to be pushed into the parser. E.g. I would like to have something like the following: public class DataReceiver { private…
Michael Barker
  • 14,153
  • 4
  • 48
  • 55
16
votes
3 answers

non-blocking "toast" like notifications for Microsoft Access (VBA)

How to show non-blocking "toast" like notifications in Microsoft Access? That does have some sort of animation and should not block the host application!
Krish
  • 5,917
  • 2
  • 14
  • 35
16
votes
2 answers

Non-blocking modal Swing progress dialog

A daft question, but I really cannot get this to work: I have some long-running process in a Swing application which may take several minutes. I want to display a progress dialog to the user while this process is ongoing. I also want to prevent the…
Zarkonnen
  • 22,200
  • 14
  • 65
  • 81
16
votes
3 answers

How to reset a socket back to blocking mode (after I set it to nonblocking mode)?

I have read this regarding setting a socket to non-blocking mode. http://www.gnu.org/software/libc/manual/html_mono/libc.html#File-Status-Flags Here is what I did: static void setnonblocking(int sock) { int opts; opts =…
n179911
  • 19,547
  • 46
  • 120
  • 162
16
votes
1 answer

If nodejs uses non blocking IO, how is fs.readFileSync implemented?

I see a lot of synchronous functions in the file system library. such as fs.readFileSync(filename, [options]). How (and why) are these functions implemented if node has async/non-blocking IO and no sleep method - and can I use the same mechanism to…
guy mograbi
  • 27,391
  • 16
  • 83
  • 122
15
votes
4 answers

Node.js - single thread, non-blocking?

I am learning Node.js and I have read that Node.js is single threaded and non-blocking. I have a good background in JavaScript and I do understand the callbacks, but what I don't really understand is how Node.js can be single threaded and run code…
Mathieu David
  • 4,706
  • 3
  • 18
  • 28
14
votes
3 answers

Is there a simple method for checking whether a Ruby IO instance will block on read()?

I'm looking for a method in Ruby which is basically this: io.ready_for_read? I just want to check whether a given IO object (in my case, the result of a popen call) has output available, i.e. a follow up call io.read(1) will not block. These are…
Dhskjlkakdh
  • 11,341
  • 5
  • 22
  • 17
14
votes
5 answers

If a nonblocking recv with MSG_PEEK succeeds, will a subsequent recv without MSG_PEEK also succeed?

Here's a simplified version of some code I'm working on: void stuff(int fd) { int ret1, ret2; char buffer[32]; ret1 = recv(fd, buffer, 32, MSG_PEEK | MSG_DONTWAIT); /* Error handling -- and EAGAIN handling -- would go here. Bail…
Michael Wolf
  • 2,179
  • 2
  • 16
  • 14
14
votes
6 answers

Non-blocking / Asynchronous Execution in Perl

Is there a way to implement non-blocking / asynchronous execution (without fork()'ing) in Perl? I used to be a Python developer for many years... Python has really great 'Twisted' framework that allows to do so (using DEFERREDs. When I ran search to…
Val
  • 151
  • 1
  • 1
  • 4
14
votes
3 answers

Async like pattern in pyqt? Or cleaner background call pattern?

I'm trying to write a short(one file pyqt) program which is responsive(so dependencies outside python/lxml/qt, especially ones I can't just stick in the file have some downsides for this use case but I might still be willing to try them). I'm…
Roman A. Taycher
  • 18,619
  • 19
  • 86
  • 141