nonblocking

Atomic Instruction

What do you mean by Atomic instructions? How does the following become Atomic? TestAndSet int TestAndSet(int *x){ register int temp = *x; *x = 1; return temp; } From a software perspective, if one does not want to use non-blocking synchronization primitives, how can one ensure Atomicity of instruction? is it possible only a...

Using Ruby's "ready?" IO method with gets, puts, etc

The standard Ruby library "io/wait" provides a method on IO objects ready? that returns non-nil if there is input available, nil or false otherwise. I know some methods like sysread and syswrite are not safe to use with higher level methods such as gets and read, and wanted to know if ready? was safe to mix with the higher level methods...

C# Best approach for a responsive UI during SQL query using COM interop

I am making a C# DLL plugin for a EXE written in VB6. I do not have access to the source of the EXE. The DLL itself works and communicates fine with the EXE. Here is the process for a event: User issues command on EXE which then calls a function in the DLL, passing an object as a parameter DLL processes data which sometimes takes a lo...

SOAP calls using EventMachine

Is there any way to make non-blocking SOAP requests within EventMachine? I'm creating a ruby application which interacts with the google adwords api (which is SOAP based), using the adwords4r gem. The application uses EM to receive messages over a stomp connection, and then processes those messages by making SOAP calls to the adwords a...

Device Driver DLL Blocking vs NonBlocking?

My company makes a product that connect to the PC via USB. I am writing a DLL driver, using Visual C#, for this product so that anyone who wants to write a program that can control or device can do so. Some of the operations that the driver will execute take several seconds for the device to complete (for example moving the motor in th...

sendfile() completion to non-blocking socket

Hi, In my program, I need to check the completion of a sendfile() operation in a non-blocking socket. How can that be done? After checking the documentation and searching on internet, I couldn't find out how to do it ...

Nonblocking sockets with Select

I do not understand what the difference is between calling recv() on a non-blocking socket vs a blocking socket after waiting to call recv() after select returns that it is ready for reading. It would seem to me like a blocking socket will never block in this situation anyway. Also, I have heard that one model for using non blocking sock...

Close calls take forever using Cocoa's asynchronous IO?

I am writing a single threaded Cocoa app and am attempting to use the NSNotificationCenter utility methodology (as that seems to be how things are done in cocoa) to do non-blocking IO. Everything seems to work fine except for when the file handle is closed. It eventually notifies me, but it takes forever. Can anyone explain why this w...

Non-Blocking UDP-Client Receive Thread-Safe Call

I have been looking for a solution to this problem for ages. I have tried many things, including BeginReceive(), but all to no avail. There must be a way to do this, make a UDP-Client receive call that is non blocking AND thread safe. I am trying to receive a message and write it to a Rich Text Box. using System; using System.Collection...

Python readline on a pipe that has been opened as non-blocking

I have a Linux fifo that has been opened in non-blocking mode. As expected, when I call read on the file object, it returns immediately. I use select to make sure there is no busy waiting, but that my program is still notified when there is any data available. Out of curiosity, I tried the readline function and was surprised to find that...

NIO: Send message and then disconnect immediately.

In some circumstances I wish to send an error message from a server to client using non-blocking I/O (SocketChannel.write(ByteBuffer)) and then disconnect the client. Assuming I write the full contents of the message and then immediately disconnect I presume the client may not receive this message as I'm guessing that the OS hasn't actu...

non-blocking SwapBuffers() with VSync=on

I am looking for a portable way to make a non-blocking SwapBuffers() even if VSync is activated. In other words, is it possible to to be notified by an event or to know the delay until the next VSync ? ...

Simple, non-blocking way to sleep?

Hello 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 System.Text.RegularExpressions Imports System.Threading.Thread [...] ''#How to keep scr...

C: non-blocking udp socket: what do I get?

Hi there, I have a problem in understanding what recv()/recvfrom() return from an non-blockig UDP socket. A bit more specific and compared to TCP (please correct me if I'm wrong): A blocking socket (either TCP or UDP) won't return from a recv() until there is some data in the buffer. This could be some number of bytes (TCP) or a comp...

Is it possible to do asynchronous / parallel database query in a Django application?

I have web pages that take 10 - 20 database queries in order to get all the required data. Normally after a query is sent out, the Django thread/process is blocked waiting for the results to come back, then it'd resume execution until it reaches the next query. Is there's any way to issue all queries asynchronously so that they can be ...

Please Help to make asynchronous socket server and client working ( written in C)

Hi, Could some please help me with these codes? I am trying to make client and server to communicate asynchronously. I mean both client and server don't wait for each other (e.g. when a server or client reads from recvfrom() and data are not present, it takes the last received one (what I named is backup). Here are the codes: client ...

do while infinite loop stop on keyboard input - C

there is any way to run an infinite cycle that stops only on user input from keyboard without asking every cycle to continue? in a C program (I'm developing a C chat that read the entries with a for(;;) loop and I need to stop it only when the user want to type and send a message) hi all! ...

C++ concurrent associative containers?

I'm looking for a associative container of some sort that provides safe concurrent read & write access provided you're never simultaneously reading and writing the same element. Basically I have this setup: Thread 1: Create A, Write A to container, Send A over the network. Thread 2: Receive response to A, Read A from container, do som...

Replace low level web-service reference call transport with custom one

I'm not sure if title sounds right actually, so I will give more explanation here. I will begin from very beginning :) I'm using c# and .net for my development. I have an application that makes requests to some soap web-service and for each user request it produces 3 to 10 requests for web-service, they should all run async to finish...

Python: nonblocking read from stdout of threaded subprocess

I have a script (worker.py) that prints unbuffered output in the form... 1 2 3 . . . n where n is some constant number of iterations a loop in this script will make. In another script (service_controller.py) I start a number of threads, each of which starts a subprocess using subprocess.Popen(stdout=subprocess.PIPE, ...); Now, in my...