multithreading

Python calling pipe.communicate() in a thread

Using Python 2.6.1 on Mac OS X 10.6.2, I've the following problem: I have a threaded process (a Thread class), and each of those threads has a pipe (a subprocess.Popen) something likeso: from threading import Thread cmd = "some_cmd" class Worker(Thread): def run(self): pipe = Popen(cmd, stdin=PIPE, stdou...

Deadlock sample in .net?

Can anybody give a simple Deadlock sample code in c# ? And please tell the simplest way to find deadlock in your C# code sample. (May be the tool which will detect the dead lock in the given sample code.) NOTE: I have VS 2008 ...

OutOfMemoryException, stack size is huge, large number of threads

Hello, I was profiling my .net windows service. I was trying to discover OutOfMemoryException and discovered that my stack size is huge and is growing because the the number of threads keeps growing. Each thread gets 1024 KB on Windows x64 machine. Thus when my app has 754 threads the stack size would be 772 MB. The problem for me is ...

wxPython, Threads, and PostEvent between modules

I'm relatively new to wxPython (but not Python itself), so forgive me if I've missed something here. I'm writing a GUI application, which at a very basic level consists of "Start" and "Stop" buttons that start and stop a thread. This thread is an infinite loop, which only ends when the thread is stopped. The loop generates messages, whi...

ASP.NET lock thread method

Hello, I'm developing an ASP.NET forms webapplication using C#. I have a method which creates a new Order for a customer. It looks similar to this; private string CreateOrder(string userName) { // Fetch current order Order order = FetchOrder(userName); if (order.OrderId == 0) { // Has no order ye...

Can getAttribute() method of Tomcat ServletContext implementation be called without synchronization?

I would like to read some parameters during servlet initializtion (in init() method), and store them among servlet context attributes (using getServletContext().setAttribute()). I would like to read these parameters later - during some request processing (using getServletContext().getAttribute()). So, the multiple threads could do this s...

Java Swing application won't quit after recieving TERM signal

I have a Java Swing application that is being used as a cluster application. The problem is that every time the cluster tries to terminate the Java application, it just hangs and Windows displays the "End Now" dialog. The said application is a server type one so it spawns a thread for every attempt to connect to it is made. I learned th...

How do I create a Thread Manager for an Android App ?

Hi, I would like to know how to start and code a thread manager for my Android App. My app is going to fill a list with a network I/O and I have to manage threads for that. I never done this before and I don't know where to start. I heard about Thread Pool and other stuff, but I'm quite confused. Could someone please help me make my way...

Are concurrency issues possible when using the WCF Service Behavior attribute set to ConcurrencyMode.Multiple and InstanceContextMode.PerCall?

We have a WCF service that makes a good deal of transactional NHibernate calls. Occasionally we were seeing SQL timeouts, even though the calls were updating different rows and the tables were set to row level locking. After digging into the logs, it looks like different threads were entering the same point in the code (our transaction...

Stack Trace of cross-thread exceptions with Invoke

When an exception happens after calling Invoke, .NET shows the stack trace as if the error happens while calling Invoke. Example below: .NET will say the error happen in UpdateStuff instead of UpdateStuff -> BadFunction Is there a way to catch the "real" exception and show the correct stack trace? Private Sub UpdateStuff() If (Me...

Clojure best way to achieve multiple threads?

Hello! I am working on a MUD client written in Clojure. Right now, I need two different threads. One which receives input from the user and sends it out to the MUD (via a simple Socket), and one that reads and displays output from the MUD, to the user. Should I just use Java Threads, or is there some Clojure-specific feature I should be...

Mutex in C# for the same assembly

We have an assembly that is called repeatedly by different executables and it shares these states how its like not thread safe because they call the code at same time what kinda mutex to use ...

How to pass a variable through a selector?

I have a method -(void)myMethod:(MyObject*)obj And I am detaching a new thread [NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil]; How can I pass a MyObject* through @selector(myMethod)? ...

Using ftplib for multithread uploads

I'm trying to do multithread uploads, but get errors. I guessed that maybe it's impossible to use multithreads with ftplib? Here comes my code: class myThread (threading.Thread): def __init__(self, threadID, src, counter, image_name): self.threadID = threadID self.src = src self.counter = counter ...

Legacy application creates dialogs in non-ui thread.

I've been working support for a while on a legacy application and I've noticed a bit of a problem. The system is an incredibly complex client/server with standard and custom frameworks. One of the custom frameworks built into the application involves validating workflow actions. It finds potential errors, separates them into warnings a...

Problem in implementing progress control using threading!

hello all, I am new to the concept of threading in C..so I find it difficult to implement that in my function...I have a simple application in which i want to display a progress bar at a particular place..In a particular funtion I will read files(in a for loop) for some manipulations(regarding my application) ...while its readin...

Is single float assignment an atomic operation on the iPhone?

I assume that on a 32-bit device like the iPhone, assigning a short float is an atomic, thread-safe operation. I want to make sure it is. I have a C function that I want to call from an Objective-C thread, and I don't want to acquire a lock before calling it: void setFloatValue(float value) { globalFloat = value; } ...

C# update GUI continuously from backgroundworker.

I have created a GUI (winforms) and added a backgroundworker to run in a separate thread. The backgroundworker needs to update 2 labels continuously. The backgroundworker thread should start with button1 click and run forever. class EcuData { public int RPM { get; set; } public int MAP { get; set; } } p...

Is there a way to synchronize Silverlight Child Window (make it like MessageBox)?

ChildWindow1 wnd1 = new ChildWindow1(); ChildWindow2 wnd2 = new ChildWindow2(); wnd1.Show(); //**Is there a way to pause thread here until wnd1 is closed???** wnd2.Show(); ...

multi thread apps crashes in release mode

Hello, I'm using Visual Studio 2008 (programming in c). I've a weird problem I worte a program that has 2 threads that runs simultaneously, a recording thread (using audio card to record into memory) and a translation thread (using a speech engine to recognize the words). when I run my program in debug mode (aka setting a breakpoint in ...