multithreading

Does Delphi have any equivalent to C's volatile variable?

In C and C++ a variable can be marked as volatile, which means the compiler will not optimize it because it may be modified external to the declaring object. Is there an equivalent in Delphi programming? If not a keyword, maybe a work around? My thought was to use Absolute, but I wasn't sure, and that may introduce other side effects....

How can I propagate exceptions between threads?

We have a function which a single thread calls into (we name this the main thread). Within the body of the function we spawn multiple worker threads to do CPU intensive work, wait for all threads to finish, then return the result on the main thread. The result is that the caller can use the function naively, and internally it'll make us...

Should I always make my java-code thread-safe, or for performance-reasons do it only when needed?

If I create classes, that are used at the moment only in a single thread, should I make them thread-safe, even if I don't need that at the moment? It could be happen, that I later use this class in multiple threads, and at that time I could get race conditions and may have a hard time to find them if I didn't made the class thread-safe i...

Limiting assembly execution number of cpu cycles

I have a project that dynamically loads in unknown assemblies implementing a specified interface. I don't know the contents or purposes of the assembly, other than it implementing my interface. I need to somehow restrict the amount of processing power available to these assemblies. Processor priority is not what I'm looking for. I can't...

What is the java signal dispatcher thread?

I was looking through a thread dump of a java process, and notice some threads blocked by signal dispatcher. What is signal dispatcher? What does it do? ...

Cancel libcurl easy handle

Is there an easy way to cancel a curl_easy_perform from another thread? ...

Interpreting Visual Studio 2005 Threads Window

I created a simple .NET windows application in Visual Studio 2005 and on just entering the main form load event my threads window is as in the following image: http://img519.imageshack.us/my.php?image=threadshh4.jpg My questions are 1)Why are there so many threads in the first place when I haven't started any(apart from my application...

Threads Manager

Im looking to build a thread manager for an application. I have already started threading and it works entirely fine but I would like to be able to programatically kill them or get information on them. Does anyone have ideas? ...

Measure Thread Expenses

Joe Duffy states in the MSDN article "Using concurrency for scalability" that the cost of creating a thread is approximately 200,000 cycles, and the cost of destroying is about 100,000 cycles. When I try to create a new thread to perform some calculations, I would like to be sure that the calculations themselves are more expensive than ...

Setting a thread priority in a service

Hello all, In my service I have a few threads that each call the CreateProcess() function to launch an external application. I would like to adjust thread (or process) priorities to normal or lower, depending on some other factors. The problem is that SetThreadPriority() function fails with an error 6 (invalid handle?). I'm passing in a...

Scenarios for Thread Ordering Service

Reading up the new Vista/Win2008 features, I wonder what is the point of the Thread Ordering Service. In other words, in which scenario the "classic" scheduler's "fair to all" policy is not sufficient, and a definite order of threads is preferrable? To clarify. What would be a concrete application that would benefit from it? Thanks fo...

What classes from Jeffrey Richter's PowerThreading library are people using?

Jeffrey Richter is looking for some input on how people are using his PowerThreading library. If anyone out there is using this, what parts of it are you using? He is looking to clean up the library and wants to know what classes people are using. http://www.wintellect.com/PowerThreading.aspx EDIT: See http://tech.groups.yahoo.com/grou...

How can I wrap a method so that I can kill its execution if it exceeds a specified timeout?

I have a method that I would like to call. However, I'm looking for a clean, simple way to kill it or force it to return if it is taking too long to execute. I'm using Java. to illusrate: logger.info("sequentially executing all batches..."); for (TestExecutor executor : builder.getExecutors()) { logger.info("executing batch....

What is the scope of finalizer thread - per application domain or per process?

Based on all my reading there should be one GC thread to invoke all finalizers. Now, the question is what is the scope of this "one" thread - per process or per application domain, as the whole intention of domains is to separate and make "independent" different applications in one process space. I read here: If an unhandled excepti...

C# How can I send a break to another sub routine?

I have a loop running that will process 1000's of records, currently once the loop is running it can't be stopped and the user must wait until it is finished. How can I stop the loop when someone clicks a 'Cancel' button? How do I break into that other routine? Thanks ...

C++/Unix Home Project Ideas

I am a C++, Unix developer, mostly in systems side, product domain. I would like to take up some side project to improve my skills in the following : Object oriented Design Multithreaded Programming, with ample scope for mutexes and semaphores Interprocess Communications in Unix Core C++ stuff (wanna use templates, handle exceptions, u...

nHibernate session and multithreading

I had a method with a lot of persistence calls that used a nHibernate session, it worked, was alright. But I needed to refactor this method, extracting a method from a content inside a loop, for multithread reasons. Then I created an class with this method. It is like a normal refactoring, but the nHibernate session inside this method ca...

How can I write a conditional lock in C#?

The thing is I've been using the lock statement to protect a critical part of my code, but now, I realize I could allow concurrent execution of that critical code is some conditions are met. Is there a way to condition the lock? ...

Reader/Writer Locks in C++

I'm looking for a good reader/writer lock in C++. We have a use case of a single infrequent writer and many frequent readers and would like to optimize for this. Preferable I would like a cross-platform solution, however a Windows only one would be acceptable. ...

Threading issues in a Java HashMap

Something happened that I'm not sure should be possible. Obviously it is, because I've seen it, but I need to find the root cause & I was hoping you all could help. We have a system that looks up latitude & longitude for a zipcode. Rather than access it every time, we cache the results in a cheap in-memory HashTable cache, since the l...