multithreading

Super slow apps caused by large number of unending AsyncTasks

I have no idea, but my app is stalling sometimes completely (not responding to touching the screen) I thought I was following all the rules for threading, but my app is apparently slowing down the Sprint EVO! I have never used an app as slow as my own. I don't get an ANR dialog, though I think I probably should get getting one. I have ...

Semaphore with priority

I know about the Semaphore class in the System.Threading namespace, but I don't see if it allows waiting threads to have different priorities levels. If two threads are waiting for an open slot, is there a way to allow the thread with the higher priority to have the first open slot available? ...

Alternative of Dispatcher class (from .net 3.0) to use in .net 2.0 context

Hi guys, I need an alternative for Dispatcher (.net 3.0) to use for a windows service (done in .net 2.0). Can you give me some idea how to achieve something like that or point me some links? I know that a dispatcher has a SynchronizationContext behind, but I don't know how I can use a SynchronizationContext into a service. If you thin...

Silverlight limitations regarding database access/multi threading

Speaking of in-browser (having not much experience with a SL, I can only assume this is a very common usage scenario) SL applications - do they have any programming restrictions with respect to database access and multi-threading? ...

Why expose event of my GTK+ widget will be freezed after a long time? Is it a GTK+ bug?

Hello... Here is my code: #include <gtk/gtk.h> static int counter = 0; static PangoLayout* layout; static GdkGC* gc1; static GdkGC* gc2; //**/static GMutex* mu; static gboolean on_expose_event(GtkWidget* widget, GdkEventExpose* event) { gchar the_string[20]; //**/g_mutex_lock(mu); gdk_draw_rectangle(GDK_DRAWABLE(widget->...

The process cannot access the file because it is being used by another process

When I execute the code below, I get the common exception The process cannot access the file *filePath* because it is being used by another process. What is the most efficient way to allow this thread to wait until it can safely access this file? Assumptions: the file has just been created by me, so it is unlikely that another app ...

Designing a perl script with multithreading and data sharing between threads

I'm writing a perl script to run some kind of a pipeline. I start by reading a JSON file with a bunch of parameters in it. I then do some work - mainly building some data structures needed later and calling external programs that generate some output files I keep references to. I usually use a subroutine for each of these steps. Each s...

Why multiple read reduce so dramaticaly the performances ?

I'm trying to understand and if possible tune my read performance from our direct-attached storage. Host : centos 5.4 2 * Intel Xeon E5520 24 Gib of memory gpfs filesystem I/O Scheduler is set to deadline, cfq doesn't seem to improve anything. Storage : 60 2Tb drives hardware raid 60 (6 * 10 drives) 8GB fiber channel connexion ...

Can the thread context class loader be null?

I'm not entirely sure how I got to this situation but somehow I'm getting a null ClassLoader from Thread.getContextClassLoader. After reading a little (not much info in the docs nor on google) I got the impression that it's valid for the current thread to have a null class loader, and calls to getContextClassLoader should be checked for ...

Question about Threads and Locks

Right now i am trying to learn more about java threading, and i have a small question that i cannot find a direct answer to anywhere. Lets say i have two threadsthat both share an object: public class FooA implements Runnable { Object data; public FooA(final Object newData) { data = newData; } public void d...

Where to check isFinishing in an activity

I recently realized that to avoid nasty exceptions I should check isFinishing in the inner AsyncTask subclasses of my activity. Where else is it a good practice to check isFinishing in an activity? ...

Is there a way to wake a sleeping thread?

Is there a way to wake a sleeping thread in C#? So, have it sleep for either a long time and wake it when you want work processed? ...

thread looper handler not being created despite code

Hey guys, so I have been getting this really weird bug in my android app that I have isolated down to the fact that a handler is not being created. The odd part, is that despite the fact 5 threads are being created, under certain circumstances...only 4 handlers are created. And then the rest of the time, 5 handlers are being created. N...

My application freezes EVO 4Gs (and everything else)

When a user presses the back key to my first activity, where I start an AsyncTask duringonCreate() that checks to see if buttons should be enabled based on whether or not websites are down. I use an HttpClient to contact www.downforeveryoneorjustme.com to determine if the site is down. When users return to this Activity the phone becomes...

Multithreaded Python script taking longer than non-threaded script

Disclaimer: I'm pretty terrible with multithreading, so it's entirely possible I'm doing something wrong. I've written a very basic raytracer in Python, and I was looking for ways to possibly speed it up. Multithreading seemed like an option, so I decided to try it out. However, while the original script took ~85 seconds to process...

python: elegant way to deal with lock on a variable?

I have code that looks like something like this: def startSearching(self): self.searchingLock.acquire() searching = self.searching if self.searching: self.searchingLock.release() self.logger.error("Already searching!") return False self.searching = True self.searchingLock.release() #some...

What is problem on this lock ?

Hello Highly there is a problem in this lock but i couldn't understand what is that. I have strong suspicious that below example doesn't lock enough well. So what can be problem ? class example { object locker = new object(); void start() { for (int i = 0; i < 1000; i++) { (new Thread(dostuff)).S...

twisted: how to communicate elegantly between reactor code and threaded code?

I have a client connected to a server using twisted. The client has a thread which might potentially be doing things in the background. When the reactor is shutting down, I have to: 1) check if the thread is doing things 2) stop it if it is What's an elegant way to do this? The best I can do is some confused thing like: def cleanup(s...

summarize silverlight multithreading access rules

Can someone be so kind as to give me a concise (general is fine) set of rules for what data/methods can and cannot be accessed from a secondary (non-UI) thread? ...

Are 64 bit assignments in Java atomic on a 32 bit machine?

If I have code like this - long x; x = 0xFFFFFFFFL; If i run this code on a 32 bit machine is it guaranteed to be atomic or is it possible that a different thread reading x, might get an incomplete/garbage value? ...