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
11
votes
4 answers

How to (can I) ask a PIPE how many bytes it has available for reading?

I've implemented a non-blocking reader in Python, and I need to make it more efficient. The background: I have massive amounts of output that I need to read from one subprocess (started with Popen()) and pass to another thread. Reading the output…
Matt
  • 775
  • 7
  • 24
11
votes
4 answers

How to get non-blocking/real-time behavior from Python logging module? (output to PyQt QTextBrowser)

Description: I have written a custom log handler for capturing log events and writing them to a QTextBrowser object (working sample code shown below). Issue: Pressing the button invokes someProcess(). This writes two strings to the logger object.…
Gilead
  • 1,263
  • 10
  • 21
11
votes
3 answers

How to make a delayed non-blocking function call

I want to call the add function of an HashSet with some delay, but without blocking the current thread. Is there an easy solution to achieve something like this: Utils.sleep(1000, myHashSet.add(foo)); //added after 1 second //code here runs…
Thomas
  • 10,289
  • 13
  • 39
  • 55
10
votes
1 answer

libuv: how to gracefully exit application on an error?

I have an application which uses libuv library. it runs default loop: uv_run(uv_default_loop()); How can the application be gracefully exited in case of a failure? Currently I am doing it like in the following example: uv_tcp_t* tcp =…
Andrei Sedoi
  • 1,534
  • 1
  • 15
  • 28
10
votes
4 answers

Is message passing via channels in go guaranteed to be non-blocking?

In order to assess whether go is a possible option for an audio/video application, I would like to know whether message passing in go satisfies any non-blocking progress guarantees (being obstruction-free, lock-free or wait-free). In particular, the…
Tobias
  • 6,388
  • 4
  • 39
  • 64
10
votes
1 answer

Nonblocking/asynchronous fifo/named pipe in shell/filesystem?

Is there a way to create non blocking/asynchronous named pipe or something similar in shell? So that programs could place lines in it, those lines would stay in ram, and when some program could read some lines from pipe, while leaving what it did…
morphles
  • 2,424
  • 1
  • 24
  • 26
10
votes
4 answers

Interrupt a connecting socket

I have a GUI with a list of servers to connect to. If a user clicks a server it connects to it. If a user clicks a second server, it will disconnect the first and connect to the second. Each new connection runs in a new thread so that the program…
Matt
  • 11,157
  • 26
  • 81
  • 110
10
votes
3 answers

Thread interrupt not ending blocking call on input stream read

I'm using RXTX to read data from a serial port. The reading is done within a thread spawned in the following manner: CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(port); CommPort comm = portIdentifier.open("Whatever",…
JDS
  • 1,233
  • 4
  • 15
  • 27
10
votes
0 answers

RouteSpecificPool timeout Occuring processing HTTP request while using NIO

We have an application in which we are making an asynchronous request to get the Servlet Response.For making asynchronous Request we are using apache nio https://hc.apache.org/httpcomponents-core-ga/tutorial/html/nio.html I am getting this…
svs teja
  • 957
  • 2
  • 22
  • 43
10
votes
2 answers

zmq-cpp: recv() waits for data despite ZMQ_DONTWAIT being set

I'm trying to implement a non-blocking receive method with ZeroMQ using the ZMQ_DONTWAIT flag but recv() behaves like being called without the flag: auto start = std::chrono::steady_clock::now(); auto have_data = sock_->recv(&reply,…
frans
  • 8,868
  • 11
  • 58
  • 132
10
votes
3 answers

Cross-platform (linux/Win32) nonblocking C++ IO on stdin/stdout/stderr

I'm trying to find the best solution for nonblocking IO via stdin/stdout with the following characteristics: As long as there is enough data, read in n-sized chunks. If there's not enough data, read in a partial chunk. If there is no data…
Dan S.
  • 123
  • 1
  • 7
10
votes
8 answers

Simple, non-blocking way to sleep?

I googled for this and read some threads here, but I haven't found a simple way to have a VB.Net application sleep for a little while and still keep the application responsive: Imports System.Net Imports System.IO Imports System.Text Imports…
Gulbahar
  • 5,343
  • 20
  • 70
  • 93
10
votes
3 answers

Nonblocking django?

At work I'm not allowed to use perl for web services. Python is allowed however. What I need to do is serve up the results of some very slow c++ binaries. Each exe takes up to 20 seconds to run. In perl I'd just use mojolicious's non blocking event…
tlrrd
  • 322
  • 3
  • 8
10
votes
2 answers

java Selector is asynchronous or non-blocking architecture

For me below are the most probable definitions for asynchronous and non-blocking I/O: Asynchronous I/O: In asynchronous I/O applications return immediately and OS will let them know when the bytes are available for processing. NON-blocking I/O: Here…
Trying
  • 14,004
  • 9
  • 70
  • 110
10
votes
4 answers

C# non-blocking socket without while(true) loop

I'm just trying to make some socket programming, using non-blocking sockets in c#. The various samples that i've found, such as this, seems to use a while(true) loop, but this approach causes the cpu to burst at 100%. Is there a way to use…
ʞᴉɯ
  • 5,376
  • 7
  • 52
  • 89