multithreading

Launching background threads on GWT startup

I have a GWT application that displays some charts rendered by JFreeChart. Every few minutes, the page refreshes, which causes the app to generate new charts. (In other words, the entire chart generation process is bootstrapped by a client request.) The problem with this is that multiple clients hitting the same server would result in mu...

Best Way to Constantly Update GUI Elements

Hi All I have a Java GUI that has a number of text fields, the values of which are populated from static variable in another class. I am interested to know what the best way is to make it so that when the variable is changed in another class, the update is instantly reflected on the GUI. If any one could make a suggestion on an effici...

Check if thread is still running

In an ASP.NET MVC application during application_start a new thread gets startet. The thread loads data into the Cache and takes 5 minutes. The application needs to be aware that the loading is in process. Thats why I want to set a flag in an application variable. I set Application["LoadingCacheActive"] to true when I start the thre...

Problem with thread-safe queue?

I'm trying to write a thread-safe queue using pthreads in c++. My program works 93% of the time. The other 7% of the time it other spits out garbage, OR seems to fall asleep. I'm wondering if there is some flaw in my queue where a context-switch would break it? // thread-safe queue // inspired by http://msmvps.com/blogs/vandooren/archiv...

Wait for pooled threads to complete.

I'm sorry for a redundant question. However, I've found many solutions to my problem but none of them are very well explained. I'm hoping that it will be made clear, here. My C# application's main thread spawns 1..n background workers using the ThreadPool. I wish for the original thread to lock until all of the workers have completed...

Workflow Foundation Threading and WCF OperationContext

Hi, I am using the WorkFlowServiceHost(in .net 3.5) to host a State Machine Workflow. I use the WCF receive activities to handle calls into the workflow. I am using a WCF authorization policy to attach claims to the incoming requests based on info in the message headers. So, further down the chain I can use the ServiceSecurityContext...

C# version of java's synchronized keyword?

Does c# have its own version of the java "synchronized" keyword? I.e. in java it can be specified either to a function, an object or a block of code, like so: public synchronized void doImportantStuff() { // dangerous code goes here. } or public void doImportantStuff() { // trivial stuff synchronized { // dangerous ...

On a C# Web Service can I find a unique thread ID or some ID for logging purposes?

I am running a Web Service in C# .NET 3.5. I want to log various calls. However since many users are hitting the same functions at once it is difficult to tell which log call belongs to which. In a C++ life we used a thread Id. What is the equivalent in C#? I have tried System.Diagnostics.Process proc = System.Diagnostics.Process.G...

Java: "implements Runnable" vs. "extends Thread"

From what time I've spent with threads in Java, I've found these two ways to write threads. public class ThreadA implements Runnable { public void run() { //Code } } //with a "new Thread(threadA).start()" call public class ThreadB extends Thread { public ThreadB() { super("ThreadB"); } public void run() {...

In what thread does the VS Debug Immediate window execute commands?

I have a multi-threaded .Net app in which thread-local storage is used to hold a flag of sorts. I have reason to suspect that the flag is being set incorrectly in one of the threads and would like to use the VS debugger to inspect when and where the flag is being set. Once I have stopped the application at a break point, can I use the i...

How is a T-SQL transaction not thread-safe?

The following (sanitized) code sometimes produces these errors: Cannot drop the table 'database.dbo.Table', because it does not exist or you do not have permission. There is already an object named 'Table' in the database. begin transaction if exists (select 1 from database.Sys.Tables where name ='Table') begin d...

Add Controls to WinForms dynamically in another Thread

Hi all, I have a Winform that contains a datagridview, bindingsource, file explorer control, etc... I need add several controls (Custom UserControls) to a Panel dynamically (like Panel.Controls.Add(...)). This process can be slow. I want to show to the user a message (waiting). What is the best way? I use Backgroundworker but I have...

What does select(2) do if you close(2) a file descriptor in a separate thread?

What is the behavior of the select(2) function when a file descriptor it is watching for reading is closed by another thread? From some cursory testing, it does return right away. I suspect the outcome is either that (a) it still continues to wait for data, but if you actually tried to read from it you'd get EBADF (possibly -- there's ...

Is it possible to kill the BackgroundWorker's thread?

Hi misters, Is it possible "kill" the thread of a BackgroundWorker? In my DoWork event, I can't check the cancellation flag, because I have a blocking call to an external COM interface or a query to a database. CancelAsync doesn't cancel the call to COM. How can I do it, please ? Any suggestions will be very appreciated. Thanks in a...

Using thread.join to make sure all threads in a collection execute before moving on

Is there a problem with this type of implementation to wait for a batch of threads to complete before moving on, given the following circumstances?: CCR or PFX cannot be used. Customer.Prices collection and newCustomer are NOT being mutated. CloneCustomerPrices performs a deep copy on each of the prices in Customer.Prices collection in...

Kill Quartz's thread after redeploying application

In my app i'm using quartz to schedule some jobs to run in my Java application on Glassfish. Sometimes when i'm redeploying my application i'm forgetting to turn off my scheduler and it's impossible to stop them after new version of app has been deployed. So, the question is how does one can stop/kill quartz's threads after application h...

Multi-threading with Informix and the IBM CSDK

I am working with Informix in C++ with the IBM CSDK client libraries. I use the multi-threaded version of the libraries and each thread uses its own ITConnection object. Still the application crashes if more than one thread is spawned. Has anybody come across a similar problem? ...

boost:thread - compiler error

Hello, I wanted to use boost::thread in my program, but get the follwing compiler error (Visual Studio 2005): Error 1 error C2064: term does not evaluate to a function taking 0 arguments d:...\boost_1_37_0\boost\thread\detail\thread.hpp 56 Therefore I tried to recreate the problem in a small program and modified the working Hello Wor...

iPhone or Cocoa: Handling order of multiple HTTP requests

When working with Cocoa/Cocoa-Touch and the iPhone SDK, a typical convention is to build a client which speaks to a server-side web server. One common problem I face when programming is making multiple HTTP requests in sequence, sometimes up to 5-6 requests. The order in which the requests are made is not linear in which they will return...

How do I maximize an application first instance when trying to start a new one

Hello, I would like to limit an application to having only one instance running on a machine. So far I have this : Mutex m = new Mutex(true, Name, out IsOwned); if (!IsOwned) { string message = "There is already a copy of the application '" + Name + "' running. Please close that application before starting a new on...