blocking

Two BlockingQueue in the same endless loop?

I have a thread, that processes incomming messages (endless loop). For this, I use a BlockingQueue (Java), which works as quite nice. Now, I want to add a second processor in the same Class oder method. The problem now is, that in the endless loop i have this part newIncomming = this.incommingProcessing.take(); This part blocks if the...

How do I/O operations block?

I am specifically referring to InputStream (Java SE) and its implementations. How is blocking performed? I'm a little worried that they use a "busy-waiting" mechanism, as it would produce a lot of overhead. I believe they do it another way, but I'm just asking to be certain. ...

How to determine what in my script is blocking my HTML rendering?

I have a web application that uses quite a bit of JavaScript. When the page loads, it's very clear visually that something is blocking the rendering of a particular portion of the web site. This portion is generated by a Tabber Tabify JavaScript library. How can I determine what's blocking the HTML rendering specifically so that I can ...

Can I make ungetc unblock a blocking fgetc call?

I would like to stuff an 'A' character back into stdin using ungetc on receipt of SIGUSR1. Imagine that I have a good reason for doing this. When calling foo(), the blocking read in stdin is not interrupted by the ungetc call on receipt of the signal. While I didn't expect this to work as is, I wonder if there is a way to achieve this...

asynchronous vs non-blocking

Hi all, What is the difference between asynchronous and non-blocking calls? Also between blocking and synchronous calls(with examples please)? Thanks. ...

How to write my own global lock / unlock functions for PostgreSQL

I have postgresql (in perlu) function getTravelTime(integer, timestamp), which tries to select data for specified ID and timestamp. If there are no data or if data is old, it downloads them from external server (downloading time ~300ms). Multiple process use this database and this function. There is an error when two process do not fin...

I want a feature to temporarly block my website from accessing?

Hi from time to time , i want to shutdown my site for maintenance ... How could i do this? I've seen a option in phpbb to block the site by admin and then unblock them.. Is there any apis for this or tell me a method of how to do this? I'm using php for my website.. ...

SQL Server 2005 Sleeping SPID blocking another SPID...

I find many sleeping process my SQL Server database and looks like one of those sleeping SPIDs is blocking another process, and that process is getting suspended too... Could some one please explain this... 1.) How can a sleeping process block another process? 2.) I see many sleeping process...is this normal? Thanks ...

OS Concepts in Layman Terms

What is the difference between the following concepts in layman terms: spinning lock, blocking and condition? ...

Is there a way to ‘join’ (block) in POSIX threads, without exiting the joinee?

I’m buried in multithreading / parallelism documents, trying to figure out how to implement a threading implementation in a programming language I’ve been designing. I’m trying to map a mental model to the pthreads.h library, but I’m having trouble with one thing: I need my interpreter instances to continue to exist after they complete ...

Does [UIWebView loadRequest] block the thread?

I've read up on UIWebView and can't find a specific answer to whether or not it can block a thread when loadRequest is called (like NSURL can). I've heard that there is a specific UIWebView thread that all UIWebView's try to load using (and as a result that thread will be blocked with a slow load), but will there be any effect on the mai...

Java BufferedReader readline blocking?

I want to make an HTTP request and then get the response as sketched here: URLConnection c = new URL("http://foo.com").openConnection(); c.setDoOutput(true); /* write an http request here using a new OutputStreamWriter(c.getOutputStream) */ BufferedReader reader = new BufferedReader(new InputStreamReader(c.getInputStream)); reader.rea...

How does Linux blocking I/O actually work?

In Linux, when you make a blocking i/o call like read or accept, what actually happens? My thoughts: the process get taken out of the run queue, put into a waiting or blocking state on some wait queue. Then when a tcp connection is made (for accept) or the hard drive is ready or something for a file read, a hardware interrupt is raised ...

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 statement, and is not 100% true. Let me just point out a few facts: You can actually mak...

Cross-platform and cross-process atomic int writes on file

Hello! I'm writing an application that will have to be able to handle many concurrent accesses to it, either by threads as by processes. So no mutex'es or locks should be applied to this. To make the use of locks go down to a minimum, I'm designing for the file to be "append-only", so all data is first appended to disk, and then the ad...

How to force main Acivity to wait for subactivity in Android?

hi, I am calling a subactivity from main activity. This subactivity should take few numbers from user (i'm using Edit text control to achieve this), save them to static variable in another class and terminate. I want main activity to wait for subactivity but both are just running simultaneously. Even doing sth like that doesn't help: ...

php cookies block access to directories

I have a mysql database of users that can login to my site and view content. I would like to block a couple of directories from certain users. What is the best way to do this. Currently when a user logs in a cookie is created with their customer id and the customer is is used to display their content. How would I block entire directori...

SQL SPID Blocking itself

I'm running SQL Server 2000. I have a situation where users are timing out. In enterprise manager I look at the locks/ProcessIDs. I see spid 79 (Blocked By 79) How is it possible for a session to block itself? ...

Can't get InputStream read to block...

I would like the input stream read to block instead of reading end of stream (-1). Is there a way to configure the stream to do this? Here's my Servlet code: PrintWriter out = response.getWriter(); BufferedReader in = request.getReader(); try { String line; int loop = 0; while (loop < 20) { ...

Sending while receiving in C

I've made a piece of code in what's on my server as multiple threads The problem is that it doesn't send data while im receiving on the other socket. so if i send something from to client 1 to client 2, client2 only receives if he sends something himself(jumps out of the recv function) .. how can i solve this ? /* Thread*/ while (! ...