blocking

Why is the FileInputStream read() not blocking?

Hi there, I've got a Writer program that writes one line of text to a file, then waits until the user hits return before it writes another line and then exits. Only after that is the file closed. The code: public class Writer { Writer() { } public static String[] strings = { "Hello World", ...

How to do blocking calls in Javascript (with Narrative Javascript)?

Hello, I am trying to understand the usage of resultNotifier of Narrative JavaScript. I wrote the code below (HTML & njs). When the code is running it displays 2 alert windows that come from these 2 instructions: alert(notifier); ------------------------> [object Object] alert(" value = " + value); --------> value = [object Object] ...

What does InputStream.available() do in Java?

What does InputStream.available() do in Java? I read the documentation, but I still cannot make it out. The doc says: Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or or another thre...

What is the purpose of hard disk direct memory access?

At first glance it seems like a good idea to let the hard disk write to RAM on its own, without CPU instructions copying data, particularly with the success of asynchronous networking in mind. But the Wikipedia article on DMA states this: With DMA, the CPU gets freed from this overhead and can do useful tasks during data transfer (th...

block list table (IP, Mac, email, name, username)

I am creating block lists to block user actions based on IP address, MAC address, Email address, Name (first/last name), Trademark names and Usernames. So should each of these be a separate lookup table or can there be 1 blocked_list table with all these in? Each is individual independent of the other. The list will be used in few pl...

C++ Serial Blocking Read

I'm trying to create a C++ serial port class for a project that i'm working on. Unfortunately I'm stuck. I need the user to be able to specify if the port read function is blocking or non-blocking. So when the user creates a port object they specify a flags variable. If flags is set then the read should return -1 if there is no data at t...

Stopping an asynchronous TCP server on separate thread in C#

I have implemented an asynchronous TCP server that is spawned by another process. It starts fine and operates as expected, however I am having trouble terminating the server when I end the process that started it. The following is my current TCP server and stopping function from the other process. TCP Server public class StateObj...

Using jQuery to block form redirections on submit until the function finishes

Is there a way, using jQuery, to force a form to wait until a function is done executing before submitting? I have a submit button on a multi-field form. I would like the submit button to hit a server to determine whether the current user has any items in the database, and if they have none, I would like it to pop up a confirmation wind...

non-blocking(event driven I/O) vs. blocking I/O

Recently I stumbled across this pretty slick JS library called nodeJS that acts like a server side JS. The main feature of the language being Evented I/O and which gives the inherent capacity of I/O being completely non-blocking!!! using callbacks. My question is if such kind of I/O mechanism which is completely non-blocking existed in...

ServerSocket blocked by thread seeking input from console

Can anyone give me insight into why the ServerSocket constructor never returns in the new thread? (I never see the "Opened" message printed to the console.) It seems the main thread prevents the server socket thread from running by entering into readLine too quickly: public class Main { public static void main(String[] args) throws I...

checking when all data is sent using non-blocking open

If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write? ...

Determing the number of bytes ready to be recv()'d.

I can use select() to determine if a call to recv() would block, but once I've determined that their are bytes to be read, is their a way to query how many bytes are currently available before I actually call recv()? ...

Constipated Python urllib2 sockets

I've been scouring the Internet looking for a solution to my problem with Python. I'm trying to use a urllib2 connection to read a potentially endless stream of data from an HTTP server. It's part of some interactive communication, so it's important that I can get the data that's available, even if it's not a whole buffer full. There se...

What threading module should I use to prevent disk IO from blocking network IO?

I have a Python application that, to be brief, receives data from a remote server, processes it, responds to the server, and occasionally saves the processed data to disk. The problem I've encountered is that there is a lot of data to write, and the save process can take upwards of half a minute. This is apparently a blocking operation, ...

Manipulate File Descriptors for select.select in Python

Hello everyone, I have an itching problem I know could be solved using many different ways, but I would still like to know if the following approach is possible in Python. Suppose I have some socket I am constantly waiting for input on, and there is some condition that eventually terminates the whole program. I want to do it in a BLOCK...

What happens to a Thread that fails to acquire a lock?

What happens to a Thread that fails to acquire a lock (non-spin)? It goes to the BLOCKED state. How does it gets executed again? Lock lck = new ReentrantLock(); lck.lock() try { } finally { lck.unlock(); } ...

Mutex lock: what does "blocking" mean?

I've been reading up on multithreading and shared resources access and one of the many (for me) new concepts is the mutex lock. What I can't seem to find out is what is actually happening to the thread that finds a "critical section" is locked. It says in many places that the thread gets "blocked", but what does that mean? Is it suspende...

Firewall blocking files using Reg_Ex needs to be adjusted

We have security in our firewall to prevent SQL-Injection from destroying any of our content: Name Type Context Severity Pattern Configure CS:select_into signature http-url critical .*\[select\].*\[into\].* Edit Remove CS:select_from signature http-url critical .*\[select\].*\[from\].* Edit Remove CS:insert_into sig...

What application is accessing the internet

A little background: I live in South Africa. And here we pay for internet. And we pay thoroughly. And unfortunately I have to use the most expensive form of internet.The problem:Every time I connect to the internet, in a matter of seconds I've use about 10 megs of CAP. And if I don't watch it, it sometimes goes up to 100 megs. Now I kno...

Java blocking issue: Why would JVM block threads in many different classes/methods?

Hi all, Update: This looks like a memory issue. A 3.8 Gb Hprof file indicated that the JVM was dumping-its-heap when this "blocking" occurred. Our operations team saw that the site wasn't responding, took a stack trace, then shut down the instance. I believe they shut down the site before the heap dump finished. The log had no errors/ex...