multithreading

Should I use BackgroundWorker or Threads when I need to scrape a website?

I'm going to screen-scrape a gaming website for some data. I'd like to be able to send multiple requests so I can screen-scrape several pages at once. I've emailed the site administrator and gotten permission to scrape at a moderate rate (a few requests per second). As far as I know BackgroundWorker uses the thread-pool which I think ...

multi threading a web application

I know there are many cases when it's best to multi thread an application but when is it best to multi thread a .net web Application? ...

What to avoid for performance reasons in multithreaded code?

I'm currently reviewing/refactoring a multithreaded application which is supposed to be multithreaded in order to be able to use all the available cores and theoretically deliver a better / superior performance (superior is the commercial term for better :P) What are the things I should be aware when programming multithreaded applicatio...

Multithreaded Programming in PHP to avoid runtime limitations.

I know about PHP not being multithreaded but i talked with a friend about this: If i have a large algorithmic problem i want to solve with PHP isn't the solution to simply using the "curl_multi_xxx" interface and start n HTTP requests on the same server. This is what i would call PHP style multithreading. Are there any problems with thi...

Why is there no overload of Interlocked.Add that accepts Doubles as parameters?

I fully appreciate the atomicity that the Threading.Interlocked class provides; I don't understand, though, why the Add function only offers two overloads: one for Integers, another for Longs. Why not Doubles, or any other numeric type for that matter? Clearly, the intended method for changing a Double is CompareExchange; I am GUESSING ...

Optimal sleep time in multiple producer / single consumer model

I'm writing an application that has a multiple producer, single consumer model (multiple threads send messages to a single file writer thread). Each producer thread contains two queues, one to write into, and one for a consumer to read out of. Every loop of the consumer thread, it iterates through each producer and lock that producer...

Thread and UI in WPF

This is XAML with a button and 3 progress bars TestBtn this is the thread to update the 3 progress bars.. Thread thread = new Thread( new ThreadStart( delegate() { ...

QTimer firing issue in QGIS(Quantum GIS)

Hi, I have been involved in building a custum QGIS application in which live data is to be shown on the viewer of the application. The IPC being used is unix message queues. The data is to be refreshed at a specified interval say, 3 seconds. Now the problem that i am facing is that the processing of the data which is to be shown is t...

In ColdFusion, why shouldn't a Set & Forget child thread have access to session/client scopes?

Threads spawned from a parent process in ColdFusion have access to the Session and Client scopes, but only until the parent process completes; so if the thread continues to run beyond that time, attempting to read from or write to one of these scopes will presumably throw an error. Why? I understand with Client scope, as this could be ...

Duplex Wcf Server Threading - Where to do synchronous DB I/O?

Here are my basic assumptions: Wcf executes my service operation methods on IOCP threads (UnsafeQueueNativeOverlapped) instead of normal ThreadPool threads (QueueUserWorkItem). Blocking I/O should not be done inside of one-way service operation methods. Blocking I/O should not be done inside of a normal ThreadPool thread. I believe t...

Setting focus on an input element after setting display:block

I have an HTML along the following lines: <div class="hiddenClass"> // this implies display:none <span> <input type="text" id="hiddenInput"/> </span> </div> and a Javascript event (triggered in a "succes" method of an jQuery $.ajax() call ), that needs to make this div visible and then set the focus to the control. Something li...

Use System.Threading.Timer with CustomThreadPool?

So, according to MSDN, System.Threading.Timer calls it's callback delegate on a ThreadPool thread. Is there any way to make it use a custom ThreadPool? (For instance, Jon Skeet's CustomThreadPool.) ...

Threaded simultaneous jobs

There is a string array myDownloadList containing 100 string URIs. I want to start 5 thread jobs that will pop next URI from myDownloadList (like a stack) and do something with it (download it), until there is no URIs left on a stack (myDownloadList). What would be the best practice to do this? ...

Killing/Aborting a thread with a single, giant task (e.g. SQL Query)

Okay, There seems to be a lot of discussion on here about how terribly awful Thread.Abort() is, and how to work around using Thread.Abort() in your code by adding exit checks in your loop. This assumes that you control how the work is being partitioned in a way that's granular enough to loop over it. But how do I do the following: L...

How can I download a file over multiple interfaces in OS X or Linux?

I have a large file I want to download from a server I have root access to. I also have several different, concurrent internet connections from my machine to the server at my disposal. Do you know of any protocol, (S)FTP client, HTTP client, AFP client, or any other file transfer protocol server and client combination that supports mul...

How do you encode an Object in a Web Worker for it to be passed via postMessage?

Internally, Firefox will JSON encode an object passed via postMessage to and from the Web Worker. However, this only works in Trunk builds of Firefox (3.6+) and not in Firefox 3.5, so the question is really how to add backwards support of this operation to the current platform. The window.atob() and window.btoa() methods had been suggest...

If I pass an object to a thread via ParameterizedThreadStart, can I access it later?

If I start a thread in the following manner Thread newThread = new Thread(new ParameterizedThreadStart(MyThreadMethod)); Object myObject = new Object(); newThread.Start(myObject); Can I find out what has it done to myObject after it has finished the task? // at some point later if(newThread.ThreadState == ThreadState.Stopped) { //acc...

C# Threadpooling HttpWebRequests

I've read and looked a quite a few examples for Threadpooling but I just cant seem to understand it they way I need to. What I have manage to get working is not really what I need. It just runs the function in its own thread. public static void Main() { while (true) { try { Thr...

How can I have many threads that need to know the next ID to process and then increment that number safely?

I'm working a program that will have a bunch of threads processing data. Each thread needs to grab the next available ID, increment that ID by 1 for the next thread and do this in a thread-safe way. Is this an instance where I would use a mutex? Should I use a Queue.Synchronized instead and fill it up with all 300,000 ID's or is this ...

In Java, how do I wait for all tasks, but halt on first error?

I have a series of concurrent tasks to run. If any one of them fails, I want to interrupt them all and await termination. But assuming none of them fail, I want to wait for all of them to finish. ExecutorCompletionService seems like almost what I want here, but there doesn't appear to be a way to tell if all of my tasks are done, exce...