multithreading

How would you implement this "WorkerChain" functionality in .NET?

EDIT: It kind of occurred to me too late (?) that all the code I posted in my first update to this question was way too much for most readers. I've actually gone ahead and written a blog post about this topic for anyone who cares to read it. In the meantime, I've left the original question in place, to give a brief glimpse at the proble...

C# Abort()ing threads on exit for a Form

So far I have this code run when the X button is clicked, but I'm not sure if this is the correct way to terminate threads on a form on exit. Type t = this.GetType(); foreach (PropertyInfo pi in t.GetProperties()) { if (pi.GetType() == typeof(Thread)) { ...

How locks obtained in multithreading and on which object?

Class ThreadTest extends Thread { public synchronized void run() { } public static void main(String args[]) { Thread t1=new ThreadTest(); Thread t2=new ThreadTest(); t1.start(); t2.start(); } } I want to know in above scenario, how locks obtained and on which object? Does above scenario valid? As locks are o...

DataGridView cells not editable when using an outside thread call

Hi, I'm not able to edit my datagridview cells when a number of identical calls takes place on another thread. Here's the situation: Dataset table is created in the main window The program receives in files and processes them on a background thread in class TorrentBuilder : BackgroundWorker creating an array objects of another class To...

Swingworker producing duplicate output/output out of order?

What is the proper way to guarantee delivery when using a SwingWorker? I'm trying to route data from an InputStream to a JTextArea, and I'm running my SwingWorker with the execute method. I think I'm following the example here, but I'm getting out of order results, duplicates, and general nonsense. Here is my non-working SwingWorker: c...

Ruby: would using Fibers increase my DB insert throughput?

Currently I am using Ruby 1.9.1 and the 'ruby-mysql' gem, which unlike the 'mysql' gem is written in ruby only. This is pretty slow actually, as it seems to insert at a rate of almost 1 per second (SLOOOOOWWWWWW). And I have a lot of inserts to make too, its pretty much what this script does ultamitely. I am using just 1 connection (sinc...

How to handle all unhandled exceptions when using Task Parallel Library?

I'm using the TPL (Task Parallel Library) in .NET 4.0. I want to be able to centralize the handling logic of all unhandled exceptions by using the Thread.GetDomain().UnhandledException event. However, in my application, the event is never fired for threads started with TPL code, e.g. Task.Factory.StartNew(...). The event is indeed fir...

Rails running multiple delayed_job - lock tables

Hey. I use delayed_job for background processing. I have 8 CPU server, MySQL and I start 7 delayed_job processes RAILS_ENV=production script/delayed_job -n 7 start Q1: I'm wondering is it possible that 2 or more delayed_job processes start processing the same process (the same record-row in the database delayed_jobs). I checked the c...

What is the performance cost of calling Thread.isInterrupted()?

From the java sources, it look like to drops into native code. Is the cost roughly equivalent to a volatile read or does it need to acquire a lock of some type? ...

What is Erlang's concurrency model actually ?

I was reading a paper recently Why Events are Bad. The paper is a comparative study of Event based and thread based highly concurrent servers and finally concludes stating that Threads are better than events in that scenario. I find that I am not able to classify what sort of concurrency model erlang exposes. Erlang provides Light Weigh...

Technically why is processes in Erlang more efficient than OS threads?

Erlangs Characteristics From Erlang Programming (2009): Erlang concurrency is fast and scalable. Its processes are lightweight in that the Erlang virtual machine does not create an OS thread for every created process. They are created, scheduled, and handled in the VM, independent of underlying operating system. As a result, process...

Command Not working in separate thread in J2me.

I am creating a bluetooth application. I created a simple midlet with a exit command and i create a thread for finding the service and discovering the device. While doing so it displays a animated screen on which i added the parent commandListener for exit command. After successful connection both user is represented with greetings(Curr...

Async call Objective C iphone

Hi guys, I'm trying to get data from a website- xml. Everything works fine. But the UIButton remains pressed until the xml data is returned and thus if theres a problem with the internet service, it cant be corrected and the app is virtually unusable. here are the calls: { AppDelegate *appDelegate = (AppDelegate *)[[UIApplicatio...

redirect output from file to three running thread

I want to use 'cat myclip.avi' command to send the output to three running thread, i am trying to process same clip file to produce three different result. can i use dup2 or how i can make pipe with thread not fork? Sorry about the question being so vague. Maybe I need to reinforce my understanding of dup2. actually i am using external ...

Suggest a open source project which heavily uses java concurrency utilities?

I have done good amount of Java programming, but yet to master Threading & Concurrency. I would like to become an expert programmer in threading & concurrency. I have also took a short at Tomcat code, I was able to understand, but looking even more complex project. Could you suggest any open source project which heavily uses java threa...

python multithread "maximum recursion depth exceed"

I use Python multithread to realize Quicksort. Quicksort is implement in a function. It is a recursive function. Each thread calls Quicksort to sort the array it has. Each thread has its own array that stores the numbers needs to be sorted. If the array size is smaller (<10,000). It runs ok. However, if the array size is larger, it shows...

How to change the current selection in a wxListbook from another thread?

How can I change the current selection in a wxListbook from another thread? When I pass the listbook's pointer to the thread and try to change the selection, the app crashes. What is a safe way of doing this? Is there some message I can send to it? ...

No speed-up with useless printf's using OpenMP

I just wrote my first OpenMP program that parallelizes a simple for loop. I ran the code on my dual core machine and saw some speed up when going from 1 thread to 2 threads. However, I ran the same code on a school linux server and saw no speed-up. After trying different things, I finally realized that removing some useless printf statem...

How to change label content with timers throwing InvalidOperationException.

Hi there, I'm making an application and I'm using a timer in that application to change label content in WPF C# .NET. In timer elapsed event I'm writing the following code lblTimer.Content = "hello"; but its throwing an InvalidOperationException and gives a message "The calling thread cannot access this object because a different thr...

how to do thread in matlab?

how to do thread in matlab? i want to run one function on two variables simulatniosly how to do it? ...