multithreading

Thread Joining or Thread suspending\resuming in c#

Hi, In windows form application, I am creating a thread for some work and in between if your clicks for some other work, then I need to suspend earlier thread and need to do new task(high priority) first and after its completion, resuming suspended one. I have a timer to check for thread states, so I can manage processing. How to do ...

How to create background process in spring webapp?

I want to run background process in parallel with my spring-mvc web-application. I need a way to start in automatically on context loading. Background process is a class that implements Runnable. Is spring-mvc has some facilities for that? ...

CreateFileMapping with multiple threads

hey. im trying to use 2 threads running simultaneously and both using FileMapping feature to map a file on memory via different handles. problem is the MapViewOfFile function sometimes allocates the mapping on both threads to the same offset of memory. i tried using mutex on those parts, but it seems after high usage i fail to write to t...

Making Threads work in parallel in c#

I am using TcpClient object to transfer the files. There is only one object. So while transferring the file, I used to lock this object and transfer the file so the other threads waits until the TCPClient is released. Is there a way I can make Threads work in parallel with a single object? ...

OO design patterns for multi-threaded synchronisation

Are there any generalisations of object and data and thread interactions given design pattern names? Obviously what goes on a lot is synchronisation on an object, passing messages through a queue and also reference counts in memory management systems. But are there any more OO-oriented names for multithreading design patterns and syste...

2 questions on locks performance/use

Hi, On the server application, I need to assign to each connected client an unique ID, so I am doing it this way: private short GetFreeID() { lock (this.mUsedPlayerIDsSynchronization) { for (short I = 1; I < 500; I++) { if (ClientIDPool[I] == false) { ClientIDPool[I] = true...

Android - drag and drop - list rearrange

How can I create a list where I can rearrange list items with dragging list rows to another row and so on (to change to order)? Just like on the HTC Hero in the clocks app where you can rearrange the order of clocks? Wouter ...

Python: Synchronize Input and Output Between Threads

Hey, Currently, I am trying to do a small project with sockets in Python, a two-user chatting system. import socket import threading #Callback. Print doesn't work across threads def data_recieved(data): print data #Thread class to gather input class socket_read(threading.Thread): sock = object def __init__(self, sock): ...

Locking, qeue question

Today I got here nice answer that will resolve my problem. Unfortunately, I forgot to ask how about locking. The issue was simple - in the server, each connected client will get an unique ID (reusable) from 1 to 500, which is maximum of clients. The answer was to create a qeue and use waiting elements for new connections and just retur...

Background threads consuming 100% CPU on iPhone 3GS causes latent main thread

In my application I am executing 10 asynchronous NSURLConnections within an NSOperationQueue as NSInvocationOperations. In order to prevent each operation from returning before the connection has had a chance to finish I call CFRunLoopRun() as seen here: - (void)connectInBackground:(NSURLRequest*)URLRequest { TTURLConnection* connecti...

How do you name a SwingWorker thread? Open to code or best practices

I'm trying to debug a horrible exception that is occurring in a SwingWorker thread. If I could name my SwingWorker threads, then I could better interpret the stack traces I am receiving. It doesn't seem possible to name a SwingWorker thread (is it?). I'm looking for any best practices or 'tricks' to help me properly identify my worker t...

Are there any thread-safe graph libraries for C++?

Basically I am looking for a graph library that would have fine-grained locking around graph operations, so that different threads touching different parts of the graph could alter it simultaneously, and competing modifications could be blocked. I googled around a bit and can't find anything. Maybe this is too specific to my needs, but...

Multithreading in XNA game

Where can I use multithreading in a simple 2D XNA game? Any suggestions would be appreciated ...

WHen the applicaiton is running, how to keep checking which is the active window simultaneously ?

My application uses SendKeys to navigate through and enter data into the input fields (I know that is not the bestway to do it, but I have to work with this limitation). Now, I want to make sure that the correct window is active when the SendKeys are at work. One way to do confirm this is to check for the current active window before e...

Access return value from Thread.Start()'s delegate function

I've got a program that executes a method through a Thread.Start. The method has a return value that I'd like to get access to. Is there a way to do this? Here's a sampling... var someValue = ""; Thread t = new Thread(delegate() { someValue = someObj.methodCall(); }); t.Start(); while (t.isAlive) Thread.Sleep(1000); // Check the val...

PerformSelector Monotouch Threading

Using this statement calls the selector immediately instead of 6 seconds from now. this.PerformSelector(myStartWaitForSoundSelector, null, 6.0f); Does anyone know how to get this to work with a delay? I am using thread.Sleep(6000) in the function that gets called, but the entire app locks up for six seconds. Thanks ...

Thread stack backtraces when program running under valgrind is interrupted

I have a server program, which doesn't have a very clean/graceful shutdown (not supposed to terminate in general). When tracing memory leaks, I run it under valgrind, but finally have to kill the process by a signal (^C). Generally I try to terminate the process when the ambiance is quiet but still then some threads might have been busy ...

Multiple SingleThreadExecutors for a given application...a good idea?

Hello friends, This question is about the fallouts of using SingleThreadExecutor (JDK 1.6). Related questions have been asked and answered in this forum before, but I believe the situation I am facing, is a bit different. Various components of the application (let's call the components C1, C2, C3 etc.) generate (outbound) messages, mos...

Why is a multithreaded environment considered harmful?

I understand if one were using a lot of widely scoped state, it's a bad idea but how about immutable computations and highly localized side effects? ...

What to use for Thread synchronization (in c#)

Hi, currently I am using lock for sending\receiving the file from FTP through TCPClient class. But this supports only single file to send and receive. So what's the better way to use in this situation (lock, mutex, interlock, read\write lock, semaphore). ...