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.

nonblocking
Filter by
Sorted by
Tagged with
2 votes
2 answers
804 views

Data structure for non-blocking aggregation of Thread values?

Background: I have a large thread-pool in java each process has some internal state. I would like to gather some global information about the states -- to do that I have an associative commutative ...
user1549692's user avatar
1 vote
1 answer
710 views

ServiceStack: Non blocking request handling

I'm looking for a way to handle non-blocking requests in a service based on the ServiceStack framework. So I've seen there's the AppHostHttpListenerLongRunningBase class (I need a self hosted app at ...
shadeglare's user avatar
  • 7,246
6 votes
1 answer
20k views

How to implement non blocking socket server in python

A similar but different question: I have an IRC client that generates strings. This IRC client uses a hook to call a method (somone_said) whenever someone says something. I want to send this string ...
Zac's user avatar
  • 2,259
0 votes
1 answer
978 views

How to convert blocking file io to non-blocking in C

I am writing a code send the output of a terminal command over a socket in C. I have tried using select for asynchronous reading and avoid blocking the event-loop, but I wasn't successful. How can I ...
orezvani's user avatar
  • 3,645
0 votes
1 answer
279 views

Ruby IO#write_nonblock when to use?

It's simple for read_nonblock since the other end might not send anything yet and we will be blocked until some data is available. But I can't think of a case that write() is blocked. Can someone give ...
w00d's user avatar
  • 5,506
94 votes
4 answers
225k views

What does Python's socket.recv() return for non-blocking sockets if no data is received until a timeout occurs?

Basically, I've read in several places that socket.recv() will return whatever it can read, or an empty string signalling that the other side has shut down (the official docs don't even mention what ...
El Ninja Trepador's user avatar
1 vote
3 answers
1k views

Does it make sense to do a select() when using ONLY 1 non-blocking socket?

My application has ONLY 1 Unix TCP socket that it uses to recv() and send(). The socket is non-blocking. Given this, is there an advantage in doing a select() before a send()/recv()? If the ...
Karthik's user avatar
  • 13
2 votes
1 answer
14k views

async wait / non blocking wait in python

i like to output each letter of a string after waiting some time, to get a typewriter effect. for char in string: libtcod.console_print(0,3,3,char) time.sleep(50) But this blocks the main ...
mahnouel's user avatar
0 votes
4 answers
14k views

Non Blocking recv() in C Sockets

I am using an infinite loop in sockets in which if it receives some data it should receive it or if it wants to send data it sends. Something like given below. I am using select. I have only one ...
Natha Kamat's user avatar
2 votes
1 answer
204 views

Why blocking code behaves better than non-blocking?

I have knocked up two little node.js snippets, that are doing the same thing, written in blocking and non-blocking ways, just to measure the performance diference. here goes: non-blocking (the ...
dark_ruby's user avatar
  • 7,806
2 votes
2 answers
3k views

Is it possible that EWOULDBLOCK be returned when partial data is received

When reading from socket, if EWOULDBLOCK is returned ..is it possible that only partial data is read? Or is it that when EWOULDBLOCK is returned data read is 0 ?
Chandu's user avatar
  • 1,949
2 votes
1 answer
496 views

Is non-blocking CAS in Java really non-blocking?

I was going over an article on non-blocking CAS and came across this code: public class SimulatedCAS { private int value; public synchronized int getValue() { return value; } public ...
212's user avatar
  • 965
2 votes
1 answer
318 views

Implementing caching technique in closest pair algorithm

I am trying to optimize the closest pair brute force algorithm and compare it with the non cached program but I am stuck. The main problem, is that I get worse performance when I cache the ...
BugShotGG's user avatar
  • 5,020
0 votes
2 answers
4k views

Non blocking connect call doesn't return connection refused

I have setup a timeout on a non-blocking connect call, which timesout correctly when the connection is attempted to an address that will not respond. However, when the connection is refused by the ...
donalmg's user avatar
  • 627
1 vote
2 answers
3k views

java.io.BufferedReader.readLine() is nonblocking

I have a problem with readLine() in Java. I have a server and a client. From client I want to send a message to the server. The problem is that first, the client has to insert a text into a JTextField ...
user avatar
4 votes
2 answers
1k views

if canonical mode is not set, nonblocking read fails?

Below code is an example of nonblocking read of terminal IO, however when I type a character on the console, it doesn't immediately print it out. Perpaps you will say I should priviously set stty -...
stonestrong's user avatar
5 votes
2 answers
22k views

Python Alarm Clock

I've made this little alarm clock with a little help from my brother. I tried it last night, with out the nonBlockingRawInput and that worked fine, but with the nonBlockingRawInput it didn't work. ...
user2340615's user avatar
29 votes
5 answers
12k views

Write PHP non blocking applications

I want to write non-blocking applications. I use apache2, but I was reading about nginx and its advantage with respect to apache processes. I am considering changing out apache for nginx. My question ...
Gonzalo Bahamondez's user avatar
1 vote
0 answers
166 views

Insert to Mongodb and MySQL together - auto increment

In an operation I need to insert data into MySQL and Mongodb together using php, I want to use the same ID to refer to both. I am new to mongodb, and the usual way I do is just use auto increment in ...
user2337223's user avatar
0 votes
1 answer
234 views

Java non-blocking IO: Is it possible to check how much you can write before calling channel.write()?

I understand a channel.write(outBuffer) can fail to write all the contents of outBuffer because the underlying socket buffer is full. Then you have to register OP_WRITE and wait for selector callbacks....
chrisapotek's user avatar
  • 6,127
9 votes
1 answer
5k views

Async read from Poco HTTPClientSession

the usual sample code for using HTTPClientSession goes something like this: Poco::Net::HTTPClientSession session(uri.getHost(), uri.getPort()); std::ostream& ostr = session.sendRequest(req); // ...
Aviad Rozenhek's user avatar
5 votes
1 answer
2k views

Select() blocking on stdin, will not time out

I am writing a program which receives UDP messages as well as takes input from users however my STDIN is still blocking with select. When I FD_CLR the stdin fd before select the program runs fine, ...
SJP's user avatar
  • 1,360
5 votes
1 answer
2k views

Linux tee command with multiple fifo. fifo blocks tee

I am trying to develope one program to play and record some rtmp streames. The program is developed in Qt. i am using the rtmpdump and mplayer. since both are running in seperate process, i am using ...
user937065's user avatar
2 votes
0 answers
602 views

Blocking, non-blocking and asynchronous I/O

I've been reading about the different types of I/O and started wondering why operating systems don't just implement non-blocking I/O and emulate blocking I/O through busy-waiting. One reason I ...
Sorin Cioban's user avatar
  • 2,235
1 vote
0 answers
945 views

Perl IO::Socket::UNIX DGRAM non-blocking socket blocks in a loop

Having an issue with socket block which I defined to be non-blocking. This way I make a new socket: unlink "/tmp/mysock"; $socket = IO::Socket::UNIX->new(Local => "/tmp/mysock", ...
niebelung's user avatar
  • 127
1 vote
2 answers
520 views

Node.js. Confused with non-blocking approach

Ok, it seems that it's hard for me to start thinking.. um.. functional way.. or asynchronous way. I am rather new to node.js, but I have many years of experience in c#, java, c++.. Image I have ...
Astro's user avatar
  • 614
0 votes
1 answer
349 views

generate statistics during pcap_loop every second

I am writing a PERL script, which captures packets, and then generate statistics in every second about all the TCP streams, which were online in that second. I am using NET::Pcap, and I want somehow ...
molnarg's user avatar
  • 445
2 votes
1 answer
1k views

How do I cleanly exit from a multiprocessing script?

I am building a non-blocking chat application for my website, and I decided to implement some multiprocessing to deal with DB querying and real-time messaging. I assume that when a user lands on a ...
Friendly King's user avatar
0 votes
2 answers
2k views

how to use jquery load() as a non-blocking event?

i have this simple load request: $('#test').load('/sidebar/test/format/html').css("display","block"); the issue is that chrome is showing the request has 1.2 sec blooking. i'm thinking of using $....
Patrioticcow's user avatar
  • 26.7k
5 votes
1 answer
422 views

Scalable self-hosted file upload to Ruby on Rails

We have a Rails 3 Application (running on Passenger) that sits behind a NGINX Server (load balancer). A major feature is file uploading from the browser. What technology is a good choice for handling ...
Roman's user avatar
  • 349
3 votes
3 answers
487 views

var++ or var-- not threadsafe?

In C++, I feel like I've always been lead to believe that things like var++ and var-- are reasonably threadsafe - AKA - you have a guarantee that your value will increase or decrease at some point in ...
user2126895's user avatar
6 votes
1 answer
377 views

Are php ticks non-blocking

I randomly came across things like: <?php declare(ticks=1); // using a function as the callback register_tick_function('my_function', true); // using an object->method $...
WojonsTech's user avatar
  • 1,277
2 votes
3 answers
5k views

How to write a non-blocking if statement in Node JS?

I have an if statement in php: if ( $isTrue && db_record_exists($id)) { ... } else { ... }; The first condition is a true / false boolean check. The second condition calls a function to ...
user1031947's user avatar
  • 6,474
2 votes
1 answer
2k views

WSAConnect returns WSAEINVAL on WindowsXP

I use sockets in non-blocking mode, and sometimes WSAConnect function returns WSAEINVAL error. I investigate a problem and found, that it occurs if there is no pause (or it is very small ) between ...
user2025098's user avatar
0 votes
1 answer
375 views

Using blocking IO in Play Framework 2.0.3

We are using a Play application that queries MySQL quite frequently. In fact, almost every operation queries the database in some way. As I understand it, Play is designed to support Async and non-...
Ravish Bhagdev's user avatar
-1 votes
1 answer
2k views

Nonblocking simultaneous assignments to wires and registers in Verilog

I am interested to write Verilog module which simultaneously will update several outputs Something like following code, makes 3 operations at the same time (clk 10): module mymodule (a,b,c,d,e); ...
YAKOVM's user avatar
  • 10k
1 vote
1 answer
1k views

Reading for char driver file in node.js?

I have implemented a Linux driver (beaglebone) that queries some hardware by SPI and copies the received data in a kfifo (which can get full if it is not emptied). - This kfifo is emptied by ...
mamahuhu's user avatar
  • 311
1 vote
0 answers
130 views

Comparison between Writing non-blocking code vs Creating a big number of webserver workers

My web application's main functionality is a blocking method that will wait 1 to 5 seconds for I/O response. I can write the method's code in a non-blocking way by creating another thread and using a ...
MostafaR's user avatar
  • 3,627
3 votes
1 answer
3k views

What is the difference between a blocking socket write and a non-blocking socket write in Java?

The difference between non-blocking reads and blocking reads is obvious, but I am confused about writes. I understand that a non-blocking write never blocks (duh!). If the underlying socket buffer is ...
chrisapotek's user avatar
  • 6,127
1 vote
1 answer
536 views

Block function call from WndProc handler function in C#

I have code in C# where Window is getting messages (images from GigE camera). In function handler I call another function to do some processing on the image I get from message. This processing can ...
galsan's user avatar
  • 63
0 votes
3 answers
5k views

How to use exitValue() with parameter?

A very good article (When Runtime.exec() won't) says: The only possible time you would use exitValue() instead of waitFor() would be when you don't want your program to block waiting on an external ...
Ios mx's user avatar
  • 85
1 vote
1 answer
942 views

gevent TCP server on Windows

I've been trying to create a TCP server with gevent without (any major) success so far. I think that the problem lies within Windows ( I've had some issues with sockets under Windows before ). I'm ...
freakish's user avatar
  • 55.3k
2 votes
1 answer
3k views

Recursion with alertify.js leading to auto-closing alerts

I am trying to convert the following old school snippet to alertify.js 0.3.8: window.doPrompt = function() { var str; do str = prompt("Enter your name"); while (str === "" && (alert("...
Janus Troelsen's user avatar
5 votes
2 answers
24k views

recv with non-blocking socket

I am trying to implement non-blocking for socket recv and the problem is that I got an error -1 when there in no data but I expect to get EAGAIN error. Socket is set definitely to non-blocking state,...
user1016711's user avatar
0 votes
1 answer
825 views

Non-blocking transactions when reading from ActiveMQ queue with STOMP

I'm interacting with ActiveMQ via STOMP. I have one process which publishes messages and a multiple processes that subscribes and processes the messages (about 10 parallel instances). After reading a ...
ygilad's user avatar
  • 1
2 votes
1 answer
437 views

Android DatagramChannel.register() block execution [duplicate]

I have generic network nonblocking socket library on Java, on default JVM all works fine, but on Android platform next code blocks : DatagramChannel channel; . . . channel.bind(...) channel....
Jhon's user avatar
  • 433
4 votes
2 answers
8k views

Impact of using select with blocking and non-blocking sockets

How will my program differ in behavior if I use non-blocking sockets with a select() call as opposed to using blocking sockets with a select() call?
DaTaBomB's user avatar
  • 623
0 votes
2 answers
1k views

Arduino compiler throws "invalid type argument of unary *"

I am trying to program a nonblocking led-blink. Therefor i programed a little class: 03: class timer { 04: private: 05: int startMillis; 06: int delayMillis; 07: public: 08: timer ( int ...
steak's user avatar
  • 2,137
2 votes
2 answers
442 views

Ruby: An Win32API call to Winsock2 ioctlsocket fails, bad address?

I want to change my Winsock2 socket from blocking to non-blocking one. And I know that this can be achieved by calling the "ioctlsocket" function in ws2_32.dll library. But my implementation fails to ...
Sunwoo Park's user avatar
2 votes
1 answer
4k views

nonblocking subprocesses in python

for a wrapper around perl i need nonblocking subprocesses in python (there is shell io of various types). Additionally i am interested in shell output and return value. Sometimes the return value is 0 ...
user501743's user avatar

1
20 21
22
23 24
33