multithreading

Good use of threads?

I have a set of operations that are very expensive but are all pretty much self-contained. Some of them rely on some "global" states or data, but all very much read-only. The operations themselves, I'm fairly certain, can all be done in parallel, but all the operations need to complete before the program progresses past a certain point. ...

Multiple animated JPanels - only last one added to JFrame is displaying?

Hi, I am making a multithreaded pacman game. There is a PacmanController class which extends JFrame, a Maze class which extends JPanel, a Pacman class which runs in its own thread and extends JPanel, and a Ghost class which runs in its own thread and extends JPanel. Each thread (pacman and each Ghost) continuously repaints itself and ...

Delphi/Indy IdHttpServer not multithreaded?

I'm using Delphi 2006 and Indy 10. I create a form and drop down an IdHttpServer component. I make an OnCreate event for the form to set the server active, and I enter these lines for the server's OnCommandGet: procedure TForm3.IdHTTPServerCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPRespo...

How do I keep my world data in synch in a multi-threaded game engine?

So I'm trying to create a simple multi-threaded game engine for the game I want to write. So far, everything has worked without any problems, I even know what steps I have to take to finish it. There is only one thing I don't know (well, technically, I know a solution for it, but I'm hoping there is something more elegant and faster): B...

Why 3 threads for a basic single threaded c# console app?

I created a console app in c# with a single console.readline statement. Running this app within visual studio and stepping into the debugger shows 7 thread in the thread window (6 worker threads, one is .NET SystemEvents and the other is vshost.RunParkingWindow and the main thread). When I run the app outside visual studio I see a total ...

WPF Wait Cursor With BackgroundWorker Thread

I want to show the hourglass cursor and disable the window while a BackgroundWorker process runs in another thread. This is what I'm doing: Private Sub MyButton_Click(...) Dim box As New AnotherWpfWindow() box.Owner = Me ... box.ShowDialog() If (box.DialogResult.GetValueOrDefault = True) Then Me.IsEnabled = ...

Python: Is this thread safe?

If I do somthing like this.. import time import threading class test(threading.Thread): def __init__ (self): threading.Thread.__init__(self) self.doSkip = False self.count = 0 def run(self): while self.count<9: self.work() def skip(self): self.doSkip = True def work(self): ...

C# GUI handle problems on close

I get a System.InvalidOperationException error when i close my app before the search is done. When i close on Form1_FormClosing i tell all my threads to abort. In one thread it has finalize which calls a delegate function which tells one of the controls in the form to change its text. When that happens I get the exception above along wit...

Thread, abort and wait

i am aborting a thread (will be threads soon enough) and the problem is i need to stall until all threads have been aborted. After doing theThread.Abort(); i thought of using theThread.Join() to wait until its been fully aborted. However that doesnt work. It just waits forever. How can i abort each thread and wait until its done before c...

How to stop an NSInvocationOperation?

I have an NSInvocationOperation that would download and parse a series of NSXMLDocuments in the background to my UI responsive. My attempt at stopping the Invocation operation is to call my NSOperationQueue's cancellAllOperations. But it seems that this won't stop the invocation's execution. Any ideas on how would I go about this probl...

Thread names--when do you need to know them?

I created a SO question about naming conventions for threads a while ago. The question was something like, "How should you name a thread?" Looking back, a thread name only matters if you have to read a thread's name. Can you provide real-world examples of when you've had to examine threads and discern between them, relying on their nam...

How to deal with ThreadPool and member variables?

Hello everyone, I am a bit new to ThreadPool in .NET. I was wondering, if I can only send one object to my callback method, how am I able to access the class member variable to call its methods? (see customClass in CallBack()) And how would I load the data from customClass? Do I pass the customClass to a different CallBack method? i...

Asynchronous operations within an asynchronous operation

My multi-threading knowledge is still pretty rudimentary, so would really appreciate some pointers here. I have an interface, IOperationInvoker (from WCF) which has the following methods: IAsyncResult InvokeBegin(object instance, object[] inputs, AsyncCallback callback, object state) object InvokeEnd(object instance, out object[] output...

How many threads can a Java VM support?

Does this vary by vendor? by operating system? other factors? ...

How's Python Multiprocessing Implemented on Windows?

Given the absence of a Windows fork() call, how's the multiprocessing package in Python 2.6 implemented under Windows? On top of Win32 threads or some sort of fake fork or just compatibility on top of the existing multithreading? ...

How Can I Get an Event Handler to be Called From a Seperate Thread than the One it Was Created On?

Hello, I'm having some trouble getting a web-page indexing program to work. I have a form that automatically downloads URLs to index from a database server and sends back responses containing the indexed page information, over UDP. I have a static class called UDP that keeps track of incoming and outgoing messages. There is an event tha...

IDE plugin's for developing multithreaded network applications

I am looking for a plugin that helps developers create multithreaded network applications that works with either Eclipse and/or Netbeans. Should allow for functionality such as: Graphical modeling of callbacks Configuring executors Creating custom SSL factories Wizards for creating various filter streams ...

Static exception instance

Hello, Are static exception instances safe to use? Any good reason to avoid the following? public class ResourceHttpHandler : IHttpHandler { private static HttpException notFoundException = new HttpException( (int)HttpStatusCode.NotFound, "Assembly Not Found"); public boo...

What's the point in Max(Threading.Interlocked.Increment(Offset), Offset - 1)?

I have seen the mentioned piece of code on several occasions now, what's the point of doing a Max(a+1, a-1)? At first I thought it might be to prevent underflow, but it doesn't really make sense not to prevent the underflow in that case. ...

How to get thread CPU utilization metrics in Redhat Linux

Dear All, I need to get CPU utilization metrics for all the threads in a process. Operating system = Redhat linux programming language = C++ using POSIX requirements = need to take samples every few seconds indefinetly, not just for one snapshot in time. constraints = not allowed to write additional code in thread I know you can u...