multithreading

How can I monitor the active thread count of a process (jvm) on linux ?

I would like to monitor the number of threads used by a specific jvm process on linux. Is there an easy way to get this information without impacting the performance of the jvm process. More specifically I am interested in the number of threads per state. ...

How to debug .NET remoting calls?

I have an app with the following basic architecture: A windows service (Service) that registers a .NET type (RemoteObject) for remote access (.NET Remoting). RemoteObject creates non-ThreadPool threads that use the ThreadPool to do IO processing. The size of the ThreadPool must be restricted to a limit for a particular reason. A GUI ap...

How to invoke a function on parent thread in .NET?

Hi all, I have a .NET class library containing a class with a method that performs some lengthy operation. When a client calls this method it should perform the lengthy operation on a new thread in order to avoid blocking the caller. But once the method finishes it should execute some code on the main thread. In a WinForms application I...

Single instance form but not singleton.

Hi all, I cannot understand how this is possible. Please help!! I have an app with a trayicon. I want a form to be show when the user double clicks the trayicon. I have a problem where it is possible to get 2 or more forms showing by quickly triple or quadruple clicking the trayicon. The reason I don't want a singleton is that I want t...

Is it possible to start a custom thread in an IIS hosted C++ application?

Hi all We host a C++ based WebServices application in IIS and we're finding that when we try to start our own C++ threads IIS has a fit and crashes. The threads are based on boost.thread which clearly dribbles down to the standard Windows threading API underneath. The reason I need to start the thread is to listen for multicasts fro...

Singleton getInstance in thread worker methods

Hello, This question is about using getter methods of a singleton object in worker threads. Here is some pseudo code first: // Singleton class which contains data class MyData { static MyData* sMyData ; int mData1[1024]; int mData2[1024]; int mData3[1024]; MyData* getInstance() { // sMyData is creat...

.Net Remoting Return values Discriminating between calls from different threads

I have inherited a middle tier system with some multi-Threading issues. Two different threads, running in the same method of the same instance of a class, are making the same calls to a .Net Remoting server... Does the proxy on the client side know how to route the return values from the remoting server to the correct thread? Are sep...

How to maintain an object for two nHibernate sessions?

I am building a multithreaded system that works like this: While there are entities: Gets an entity from nHibernate (using the current session) Starts a new thread that will work with this entity* When I start this new thread, it is required to have a new Session, because nHibernate is not thread-safe. I create it, but the entity re...

Can I create a unique filename based on ProcessID and ThreadID?

I have a delphi (Win32) web application that can run either as a CGI app, ISAPI or Apache DLL. I want to be able to generate a unique filename prefix (unique for all current requests at a given moment), and figure that the best way to do this would be to use processID (to handle CGI mode) as well as threadID (to handle dll mode). How wo...

How to parse logs written by multiple threads?

I have an interesting problem and would appreciate your thoughts for the best solution. I need to parse a set of logs. The logs are produced by a multi-threaded program and a single process cycle produces several lines of logs. When parsing these logs I need to pull out specific pieces of information from each process - naturally this i...

Does TThread work differently in a Delphi 2006 console application?

We have a pretty mature COM dll, which we test using DUnit. One of our recent tests creates a few threads, and tests the object from those threads. This test works fine when running the test using the gui front-end, but hangs when running as a console application. Here's a quick pseudo view of what we have in the test SetupTest; fThread...

Force multi-threaded VB.NET class to display results on a single form

I have a windows form application that uses a Shared class to house all of the common objects for the application. The settings class has a collection of objects that do things periodically, and then there's something of interest, they need to alert the main form and have it update. I'm currently doing this through Events on the objects...

Is this way of detecting heartbeats threadsafe and consistent?

This question has been discussed in two blog posts (http://dow.ngra.de/2008/10/27/when-systemcurrenttimemillis-is-too-slow/, http://dow.ngra.de/2008/10/28/what-do-we-really-know-about-non-blocking-concurrency-in-java/), but I haven't heard a definitive answer yet. If we have one thread that does this: public class HeartBeatThread extend...

How to send a message to a TThread from main thread in Delphi?

I want to send a message to a thread and handle it in the thread. How can I do this in Delphi? I guess PostMessage is the way, but the examples I've seen so far are describing the other way -ie. from thread to main thread. ...

Does the lock(objlocker) make that object thread safe app wide? And are static members automatically thread safe?

When you lock an object is that object locked throughout the whole application? For Example, this snippet from C# 3.0 in a Nutshell Section 19.6.1 "Thread Safety and .NET Framework Types": static void AddItems( ) { for (int i = 0; i < 100; i++) lock (list) list.Add ("Item " + list.Count); string[] items; l...

Parallel quicksort: recursion using Boost Bind?

I am working on making quicksort parallel, threads being the first attempt. The non threaded version sorts correctly but the threaded doesn't (no surprise there). What I found interesting was when I removed the threads but kept the boost::bind calls it still doesn't work. If boost::bind isn't what I want please offer a suggestion. Bi...

Cross-class-capable extendable static analysis tool for java?

I'm trying to write rules for detecting some errors in annotated multi-threaded java programs. As a toy example, I'd like to detect if any method annotated with @ThreadSafe calls a method without such an annotation, without synchronization. I'm looking for a tool that would allow me to write such a test. I've looked at source analyze...

Which situations to multi-thread in Rails

Rails is now making multi-threaded applications possible, but it doesn't sound like it applies in every situation (for instance, if you're using Mongrel, it doesn't sound like this affects you at all). When can you multi-thread your Rails application? This article gives some more information about multi-threading pitfalls. ...

Is possible having two COM STA instances of the same component?

I had a problem discovered on another thread here, I need to access a COM component that is STA. I'll run it on a dual-core computer, a process using this component only reaches 50% of CPU. Unfortunately, the owners said they can't change the component to MTA, because the component is a hybrid system compiled at Matlab, which core is C. ...

.Net Threading Problem

Here is my code: ThreadStart threadStart = controller.OpenFile; Thread thread = new Thread(threadStart); thread.Start(); In the OpenFile function my code looks like: System.Console.Error.WriteLine("Launching"); The code in OpenFile doesn't get executed for 30 seconds exactly. It starts immediately on my machine but in our producti...