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

Node.js vs Async/await in .net

Can someone explain/ redirect me, what is the difference between Node.js's async model(non blocking thread) vs any other language for example c#'s asynchronous way of handling the I/O. This looks to me that both are same model. Kindly suggest.
PKV
  • 773
  • 1
  • 7
  • 17
53
votes
2 answers

How can I execute a node.js module as a child process of a node.js program?

Here's my problem. I implemented a small script that does some heavy calculation, as a node.js module. So, if I type "node myModule.js", it calculates for a second, then returns a value. Now, I want to use that module from my main Node.JS program. I…
user1822364
  • 531
  • 1
  • 4
  • 3
49
votes
3 answers

simultaneously read and write on the same socket in C or C++

I am implementing a simple server, that accepts a single connection and then uses that socket to simultaneously read and write messages from the read and write threads. What is the safe and easy way to simultaneously read and write from the same…
Jimm
  • 8,165
  • 16
  • 69
  • 118
48
votes
8 answers

How to make non-blocking javascript code?

How can I make a simple, non-block Javascript function call? For example: //begin the program console.log('begin'); nonBlockingIncrement(10000000); console.log('do more stuff'); //define the slow function; this would normally be a…
user1717828
  • 7,122
  • 8
  • 34
  • 59
46
votes
8 answers

How do you do non-blocking console I/O on Linux in C?

How do you do nonblocking console IO on Linux/OS X in C?
nonpolynomial237
  • 2,109
  • 4
  • 27
  • 35
45
votes
13 answers

Non-blocking console input C++

I'm looking for a (multiplatform) way to do non-blocking console input for my C++ program, so I can handle user commands while the program continually runs. The program will also be outputting information at the same time. What's the best/easiest…
Doug
  • 935
  • 2
  • 10
  • 15
45
votes
4 answers

PySerial non-blocking read loop

I am reading serial data like this: connected = False port = 'COM4' baud = 9600 ser = serial.Serial(port, baud, timeout=0) while not connected: #serin = ser.read() connected = True while True: print("test") reading =…
DominicM
  • 6,520
  • 13
  • 39
  • 60
40
votes
7 answers

Java thread per connection model vs NIO

Is the non-blocking Java NIO still slower than your standard thread per connection asynchronous socket? In addition, if you were to use threads per connection, would you just create new threads or would you use a very large thread pool? I'm writing…
Kevin Jin
  • 1,536
  • 4
  • 18
  • 20
39
votes
2 answers

Non-Blocking read from standard I/O in C#

I want a non-blocking read function from console. How do I write that in C#?
Masoud
  • 1,354
  • 6
  • 18
  • 30
38
votes
2 answers

Is the UNLINK command always better than DEL command?

In Redis 4.0, there is a new command UNLINK to delete the keys in Redis memory. This command is very similar to DEL: it removes the specified keys. Just like DEL a key is ignored if it does not exist. However the command performs the actual…
user3219492
  • 774
  • 1
  • 10
  • 18
37
votes
2 answers

Spring WebFlux differences when Netty vs. Tomcat is used under the hood

I am learninig spring webflux and I've read the following series of articles(first, second, third) In the third Article I faced the following text: Remember the same application code runs on Tomcat, Jetty or Netty. Currently, the Tomcat and Jetty…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
37
votes
1 answer

Can I make a fully non-blocking backend application with http-kit and core.async?

I'm wondering if it's possible to put together a fully non-blocking Clojure backend web application with http-kit. (Actually any Ring-compatible http server would be fine by me; I'm mentioning http-kit because it claims to have an event-driven,…
Valentin Waeselynck
  • 5,950
  • 26
  • 43
35
votes
4 answers

Is there a non-blocking version of MessageBox.Show (or something like it)?

Long-delayed update I'm accepting MUG4N's answer to this question, and I also want to respond to some of the criticisms that were raised against it. ChrisF said: ...you can't make UI calls directly from background threads. This is a blanket…
Dan Tao
  • 125,917
  • 54
  • 300
  • 447
34
votes
1 answer

Linux Blocking vs. non Blocking Serial Read

I have this code for reading from Serial in Linux , but i don't know what is the difference between blocking and non blocking in reading Serial Port and which one is better in which situation?
Mohsen Zahraee
  • 3,309
  • 5
  • 31
  • 45
33
votes
3 answers

Can SQLAlchemy be configured to be non-blocking?

I'm under the impression that database calls through SQLAlchemy will block and aren't suitable for use in anything other than synchronous code. Am I correct (I hope I'm not!) or is there a way to configure it to be non-blocking?
Matty
  • 33,203
  • 13
  • 65
  • 93