multithreading

Backgroundworker runworkercompleted not firing

I have a really weird problem with background worker. Code is too complicated so will try and explain the problem just want to know if anyone has seen something similar. We have the UI thread spinning off a background thread The background thread does some printing to a pdf printer in the background When finished it just dies as in the t...

VB.NET Cross-threading operation not valid even though Invoke is used!

I've been reading around trying to find out why I'd be getting this exception to no avail. I hope someone has seen this before: I'm using Visual Basic 2010. Briefly, I have a "Settings Panel" form which takes a while to create (it contains a lot of labels and textboxes), so I create it in another thread. After it's loaded, it can be ...

Long-running computations in node.js

I'm writing a game server in node.js, and some operations involve heavy computation on part of the server. I don't want to stop accepting connections while I run those computations -- how can I run them in the background when node.js doesn't support threads? ...

Do java threads get deleted when they finish

Say I spawn a thread every couple seconds using the method below and every thread takes about a second to complete. Do the finished threads get deleted? new Thread (new myRunnableClass()).start(); ...

Delphi: Running threads count

Hi everyone, I'm using delphi 2010, is there anyway to know running threads count of the project via delphi function or windows api? ...

Proper Queue threading technique in c#?

I wanted to implement a windows service that captures dropped flat delimited files to a folder for import to the database. What I originally envision is to have a FileSystemWatcher looking over new files imported and creating a new thread for importing. I wanted to know how I should properly implement an algorithm for this and what tec...

How does ThreadMonitor work?

I use work manager to do database synchronization in several university to core banking: the sync will start every 5 minutes until completed. but I've got an error: ThreadMonitor W WSVR0605W: Thread "WorkManager.DefaultWorkManager : 1250" (00001891) has been active for 1009570 milliseconds and may be hung. There is/are 2 thread...

Typecasting to void pointer & back

I have a function: void *findPos(void *param) { int origPos=(int)param; ... } Which I am calling as a thread runner: pthread_create( &threadIdArray[i], NULL, findPos, (void *)i ); Now, this way, I get the value of origPos as the typecasted void pointer param, ie. i. This feels like a dirty hack to get around the limitation of...

Java Thread , How it comes the answer is A?

The question is from http://www.javacertifications.net/javacert/scjp1.6Mock.jsp Questions no -20 What is the output for the below code ? public class Test extends Thread { static String sName = "good"; public static void main(String argv[]) { Test t = new Test(); t.nameTest(sName); System.out.pr...

Is Crystal Report with Output = toWindow from Delphi background thread possible?

Hi, is it possible to execute a crystal report (TCrpe component) from a Delphi non VCL main thread when Output = toWindow? I execute reports from a background thread, and when Output is toPrinter or toExport, everything is fine. I know that creating forms in a Delphi non VCL main thread generally is a bad idea. When a Crystal Report...

Lightest synchronization primitive for worker thread queue

I am about to implement a worker thread with work item queuing, and while I was thinking about the problem, I wanted to know if I'm doing the best thing. The thread in question will have to have some thread local data (preinitialized at construction) and will loop on work items until some condition will be met. pseudocode: volatile bo...

Socket/threading problem: The Undo operation encountered a context that is different from what was applied in the corresponding Set operation

Hi, I'm having problems with the above much asked-about error. We have a TCP/IP server application which has been working fine for some years. I now need to allow the application to accept connections from directly connected USB devices, by internally using a socket connection to patch through to localhost (127.0.0.1) within the server...

IDisposable implementation for the class which holds threads

Good morning! Let's assume we have the following class: class MultithreadOperation : IDisposable { private IList<Thread> operationThreads; public void StartOperation() { // Initialize and start threads and put them to operationThreads } public void StopOperation() { // Aborts each thread. ...

Boost Smart Pointers and threading

If you have to pass objects across threads which smart pointer type is best to use? Assuming the object being passed is thread safe. ...

how to create Synchronized arraylist

i have created synchronized arrayList like this import java.text.SimpleDateFormat; import java.util.*; class HelloThread { int i=1; List arrayList; public void go() { arrayList=Collections.synchronizedList(new ArrayList()); Thread thread1=new Thread(new Runnable() { public void run() { while(i<=10) { arrayList.ad...

COM + WaitForSingleObject

I've been trying to find a good architecture for one application for the last few days, and after some research I'm finally stuck, and the reason is COM. The app in question will have multiple GUI threads, and they will schedule work items for worker thread. The worker thread will initialize COM via CoInitialize(NULL);, create few COM c...

Making threads wait

I have a bit of a problem. I have a java application and when it starts it needs to make around six maybe seven threads that just wait for some sort of event to occur (i.e. user presses a button). An example of how I make these threads is below. The problem is, I open my task manager only to see that all my four cpu cores are at 100% (up...

Integer won't increment?

Okay, so I have a client/server test going on, and I am passing the Integer playerID to a thread where it gives the int value to a simple Player object, than increments playerID by 1. public static void main(String[] args) throws IOException { Vector<Player> player = new Vector<Player>(); SlickServer ss = new SlickSer...

what is the difference between code with this line and without? the line before x = 5; in Starter() method

// The problem in Starter() // with any line before x = 5 ; for example System.out.println(" Anything"); // the result "x = 4" // but without the result = "x = 9" // Why?????? public class Starter extends Thread { private int x = 2; public static void main(String[] args) throws Exception{ new Starter().wa...

Multithreading in a stateless session bean?

The EJB 3.0 specification does not allow a business method of a stateless session bean to create new threads. Why is that? What is wrong with creating additional worker threads that only do raw computations and never call into the app server? Say, my session bean implements a service that lets users to upload images, and the business me...