multithreading

Can I set a breakpoint in Visual Studio (c++) to break on a thread context switch?

We want to only break in a certain thread. Any idea how to do that? I can't seem to find a way to break on that condition. I should have been more specific in the text. As the title suggests, I would like to break on the context switch into the thread. ...

What happens to thread as onDestroy is called when device is rotated

I would like to know as to what will happen to the thread which has been created by an activity and the device is rotated. I have observed that the onDestroy method is called when this happens. Will the thread be killed too? If the thread is not killed, how can I reassociate the thread with the activity as a new instance of the activity...

UI Thread .Invoke() causing handle leak?

In what circumstances would updating a UI control from a non-UI thread could cause the processes' handles to continually increase, when using a delegate and .InvokeRequired? For example: public delegate void DelegateUIUpdate(); private void UIUpdate() { if (someControl.InvokeRequired) { someControl.Invoke(new DelegateUI...

What to use to wait on a indeterminate number of tasks?

I am still fairly new to parallel computing so I am not too sure which tool to use for the job. I have a System.Threading.Tasks.Task that needs to wait for n number number of tasks to finish before starting. The tricky part is some of its dependencies may start after this task starts (You are guaranteed to never hit 0 dependent tasks un...

How can I make a single WCF method ConcurrencyMode.Multiple when service is ConcurencyMode.Single

I have a service which is defined as ConcurrencyMode.Single: [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, UseSynchronizationContext = false, InstanceContextMode = InstanceContextMode.PerSession, IncludeExceptionDetailInFaults = true)] public class MyService : IMyService This service provides a method to tell ...

ASP.NET Exception Handling in background threads

When I do ThreadPool.QueueUserWorkItem, I don't want unhandled exceptions to kill my entire process. So I do something like: ThreadPool.QueueUserWorkItem(delegate() { try { FunctionIActuallyWantToCall(); } catch { HandleException(); } }); Is this the recommended pattern? It seems like there should be a simpler way to do this. ...

logging one thread in Java using log4j

I have an web application written in Java, and I have a thread-pool. The application is huge, and I cannot make major changes, for example, I cannot change log4j. I am executing a batch process in the thread pool, and I want to log everything that goes is executed to execute that process. There will always be just one thread active in...

Understand the concept of MultiThreading in Java

Hello All... Recently I have gone through with one simple threading program, which leads me some issues for the related concepts... My sample program code looks like : class NewThread implements Runnable { Thread t; NewThread() { t = new Thread(this, "Demo Thread"); System.out.println("Child thread: " + t); ...

C# Need to wait for a COM event to fire before continuing execution without control over event

I've read a few other questions that seem similar but I'm still very confused, and none of the answers seem to be working for me so I decided to ask another question. Please bear with me, I'm not very well versed on threading and what not. The application I am making is a 3rd party add-in for Revit Structure. The way they work is I hae ...

Why does this threading approach not work?

I have a wierd problem with threading in an ASP.NET application. For some reason, when I run the code in the request thread, everything works as expected. But when I run it in a separate thread, nothing happens. This is verified by calling the below handler with the three flags "on", "off" and "larma" respectively - in the two first case...

JAVA - Strange problem (probably thread problem) with JTable & Model

I am using 2 Tables (JTable) with their DefaultTableModels. The first table is already populated. The second table is populated for each row of the first table (using an SQL Query). My purpose is to export every line of the first table with it's respective lines of the second in an Excel File. I am doing it with a for (for each line of ...

I/O between AIR client using Native process and executable java .jar

I am using Adobe AIR 2.0 native process API to launch a java executable jar. I/O is handled by writing to the input stream of the java process and reading from the output stream. The application is event based where several events are fired from the server. We catch these events in java code, handle them and write the output to the outp...

Commands implicitly threaded in Makefiles ?

Hi, I have a "super" makefile which launches two "sub" make file: libwebcam: @echo -e "\nInvoking libwebcam make." $(MAKE) -C $(TOPDIR)/libwebcam uvcdynctrl: @echo -e "\nInvoking uvcdynctrl make." $(MAKE) -C $(TOPDIR)/uvcdynctrl uvcdynctrl uses libwebcam... I noticed that those two builds are launched ...

How to execute task for a specific period in Java.?

In fact I would execute a specific task( a set of instructions) for a determined period. For example : I want my program to execute the task for 5 minutes, if it gets the right result it stops , else it will continue executing normal task for the 5 minutes and in the end it tells me. How can I implement this in Java. ...

How to control Open MP thread pooling?

Hi, I have been using Open MP to speed up an application. However I seem to be having a problem with the creating of additional thread pools. I am compiling on Windows XP using Visual Studio 2005 (Open MP 1.0). The program is similar to a web server, a request from a client comes in and I spawn a thread (using beginthread), this thread...

Timer (System.Threading) thread safety

Does anyone know if this code would be thread safe, or do I have to use lock when calling timer2.Change? Timer timer1 = new Timer(timerCallback1); Timer timer2 = new Timer(timerCallback2); timer1.Change(5000, 5000); timer2.Change(3000, 3000); public void timerCallback1(object state) { timer1.Change(Timeout.Infinite, Timeout.Infinit...

Does the Java Memory Model (JSR-133) imply that entering a monitor flushes the CPU data cache(s)?

There is something that bugs me with the Java memory model (if i even understand everything correctly). If there are two threads A and B, there are no guarantees that B will ever see a value written by A, unless both A and B synchronize on the same monitor. For any system architecture that guarantees cache coherency between threads, the...

[C++] Is it possible to use threads to speed up file reading ?

Hi there, I want to read a file as fast as possible (40k lines) [Edit : the rest is obsolete]. Edit: Andres Jaan Tack suggested a solution based on one thread per file, and I want to be sure I got this (thus this is the fastest way) : One thread per entry file reads it whole and stocks its content in a container associated (-> as ma...

android thread management onPause

I have a class that extends the Thread class and has its run method implemented as so. public void run(){ while(!terminate){ if(paused){ Thread.yield(); }else{ accummulator++; } } } This thread is spawned from the onCreate method. When my UI is hidden (when the Home key is press...

How to change a JLabel's text in a loop without switching so fast the user can't see it?

I want to create a simple clock using Java. The code is so simple that I will give an example: for(int i=0;i<=60;i++) jLabel11.setText( Integer.toString(i) ); The problem is while I'm running my program the result didn't show each update in sequence. It show only the 60 digit immediately, without showing the change from 1 to 2 to 3...