multithreading

Any good Spring threading with a TaskExecutor examples?

I'm trying to get a handle on how to implement threading in a Java application that uses Spring for transaction management. I've found the TaskExecutor section in the Spring documentation, and ThreadPoolTaskExecutor looks like it would fit my needs; ThreadPoolTaskExecutor This implementation can only be used in a Java 5 environm...

Synchronisation c#

I have two threads in c#.. Now i need to wait for a particular statement to be executed before I can continue execution in the other thread which obviously is a case of synchronisation. Is there any code that can carry this out as in using an in-built method? OK guys.. This is the code example: public void StartAccept() { ...

Will values in my ThreadStatic variables still be there when cycled via ThreadPool?

I am using ThreadStatic variables to store some data, but I am worried that the data I store on the thread will still be there after I am finished with it and release back to the ThreadPool. Do I need to worry about clearing my ThreadStatic variables before I am finished with the thread? Or will the ThreadPool do this for me before "pa...

Is it possible to halt the execution of all other threads when reaching a breakpoint in gdb?

So, as soon as I hit a breakpoint in some thread, is it possible to halt other threads until I continue? ...

asp.net update UI using multi-thread

I have an ASP.NET website containing the following <asp:UpdatePanel ID="UpdatePanel1" runat="server" > <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> </asp:UpdatePanel> I have created a thread function. And during the execution of thi...

Passing data back from external dll with threads...

I have a common comms library that i have written to communicate with our hardware over TCP/IP The common library allows both the clients application and our engineer tool to share common code. The common library runs threads that need to return data back to forms. I have some working code but I feel that there must be an easier way ...

Multiple Swing event-dispatch threads

I would like to create a new event-dispatch thread in Swing, and I'm having trouble finding any references online for how to do this. I have done this in .NET by creating a new thread and calling Application.run(...). Has anyone done this? Is it possible in Swing? FYI the reason I am trying to do this is because I am writing an Eclip...

Do I need a lock when only a single thread writes to a shared variable?

I have 2 threads and a shared float global. One thread only writes to the variable while the other only reads from it, do I need to lock access to this variable? In other words: volatile float x; void reader_thread() { while (1) { // Grab mutex here? float local_x = x; // Release mutex? do_stuff_wi...

How to catch exceptions on another thread without affecting the debugger

I have a udp service which is listening on a socket for udp datagrams: int result = 0; try { result = m_ReceivingSocket.Receive(buffer); } catch (SocketException e) { Log.Debug("Timed out with socket exception, so no result was found.", e); } It does this on a Timer every 1 millisecond because it is important that I get the udp me...

A Java Plugin Framework that supports JARs

More specifically, is there any Java plugin frameworks have all of the below features: Support for multiple JAR files JARs can be signed and/or sealed Can perform a license check for each JAR prior to instantiation Can load multiple JARs using multiple threads ...

In Java, how do you determine if a thread is running?

How do you determine if a thread is running? ...

Dining Philosophers problem - A Clarification needed

Recently I read this Wikipedia article regarding the Dining Philosophers problem but I am not clear with Chandy / Misra solution. According to the article, "When a philosopher with a fork receives a request message, he keeps the fork if it is clean, but gives it up when it is dirty." In the context of this question, he passes it if he i...

C# multithreading

Take a look at the code below. Assume that this is the ENTIRE class. I have not omitted ANY code. This is literally all it does. If I instantiate this class in my main program loop and call myExample.Add(whatever) from time to time, do I need to worry about any problems caused by not locking around Dequeue() and Enqueue()? public class...

How can I end a Lua thread cleanly?

My situation is that I'm using the Lua (C) API to execute a script held in a string. I would like the user to be able to terminate the execution of the script (this is essential if the script contains an infinite loop), how can I do this? lua_State *Lua = lua_open(); char * code; // Initialisation code luaL_dostring(L, code); ...

busy wait threads in java

Hello, I have an assignment with threads and I cant have the threads go into busy wait state. How do I know if a thread is in blocking state or in busy wait? Is there a command that checks it? In the program I have 2 matrices and I need to transform them. So I have a transform thread and the code is as follows: transformThread transfo...

ASP.NET - Web page request to unzip file on server.

We use SharpZipLib. We need to be able to unzip files on server and place them in separate folder. The request to unzip a file will be from user on a web page. I imagine if the files are large enough it will take a long time to unzip. We don't want users to be stuck on the page while waiting for unzip to complete in order to continue b...

Passing structures as arguments while using pthread_create()

I tried passing a structure as the 4th argument while using pthread_create() with something like this: pthread_create(&tid1, NULL, calca, &t); //t is the struct Now whenever I try to access variables in the structure - t.a, t.b or t.c, I keep getting an error - request for member in something not a structure or union. What alternate ...

Timer vs Thread primitive in Java

Has anyone observed that creating a thread that does work in a while(true) loop with a Thread.sleep(t) appears to consume more CPU than creating a Timer in Java with a wakeup of t? Anyone with JVM expertise know why this is? I've only really tried this on Windows and Linux x86. ...

j2me networking, threads and deadlocks

The simple piece of midlet code (class Moo) below (after the excerpts) deadlocks (At least I assume it deadlocks after reading this post on threads here). I have reproduced the relevant excerpts from the post : String url = ... Connection conn = null; try { conn = Connector.open( url ); // do something here ...

Multithreading with Inheritance (C++)

I am trying to call the "Run" function in a new thread. Right now, I have this code using openMP that doesn't actually run "Run" in a new thread. NOTE: I am not asking for help using OpenMP. This code was just a quick fix. I would prefer a CreateThread() method of going about this. vector<ICommand*>* commands; string strInput; // For ea...