Is there an elegant way to know when a worker thread is done executing so I can access resources it produced?
For example if the worker thread queried a list of SQL Servers using
ServersSqlDataSourceEnumerator.Instance.GetDataSources();
and saved the result in a DataTable variable, what mechanism can I use to know when this DataTable...
So I've seen a lot of articles now claiming that on C++ double checked locking, commonly used to prevent multiple threads from trying to initialize a lazily created singleton, is broken. Normal double checked locking code reads like this:
class singleton {
private:
singleton(); // private constructor so users must call instance()
...
Is there any way to process all Windows messages while the UI thread is waiting on a WaitHandle or other threading primitive?
I realize that it could create very messy reentrancy problems; I want to do it anyway.
EDIT: The wait occurs in the middle of a complicated function that must run on the UI thread. Therefore, moving the wait to...
Hi I'm developing a .Net application and I want to achieve the following:
I have a winforms application, and a timer (System.Timers.timer) that excecutes a thread based on a schedule. The problem is that I cannot access the UI (windows form) from the secondary thread (WorkerThread), the error say something like the component cannot be a...
newCachedThreadPool() V/s newFixedThreadPool(...)
when to use and which is better in terms of resource utilisation?
...
Let's say I have my client application and it makes a connection to the MySQL server. Fantastic. I don't implement this as a thread. I just utilise the MySQLConnection class.
And now let's say Jim who's really careless about the office accidently reboots the MySQL server without asking permission first.
I want to know when the disconne...
Hello,
I have a general Question about inter-thread communication.
Right now I am using a bunch of C++ thread (~15).
They are all using BusyWait(Polling) each others to get data to process. But it is hard to keep cpu usage low && give good performance and avoiding doing too many context switch.
So I am looking at Condition variable, ...
The software im currently working on sometimes hangs when I close the serial port. Its intermittent and works fine 90% of the time but I clearly have an issue. When I ctl+Alt+Break it shows that its waiting on serial.Close().
I have lots a data coming in and out on the serial port which is being invoked to a number of forms so is this a...
What does this from General Recommandation #3 mean?
Don't control the execution of worker
threads from your main program (using
events, for example). Instead, design
your program so that worker threads
are responsible for waiting until work
is available, executing it, and
notifying other parts of your program
when finis...
This is the setup I have, this code works properly
private void butGo_Click(object sender, EventArgs e)
{
threadCreateImages.RunWorkerAsync();
}
private void threadCreateImages_DoWork(object sender, DoWorkEventArgs e)
{
PatientToHL7MSHManager tvPatientToHL7MSHManager = new PatientToHL7MSHManager();
tvPatientToHL7MSHManager.LoadB...
My current site is set up to leave messages for certain people the first time anyone logs into the app. The number of messages left could be anywhere from 1000 to 10000, with each being a query, and all queries in a transaction statement.
Yes, I know this seems like poor design, that is not my question.
Currently, when a user logs in,...
I am showing a splash screen on a background thread while my program loads. Once it loads I am aborting the Thread as it's only purpose was to show a Now Loading splash form.
My problem is that when aborting a Thread it throws a ThreadAbortException that the user can just click Continue on.
How do I deal with this? I was trying to ...
I need to send emails via a background job on a classic-asp app so the user doesn't have to wait for a slow webserver to complete sending the email.
I know I can use Ajax to generate two separate requests, but I'd rather not require Javascript. Plus, I suspect there's a better way to pull this off. Ideas?
...
I have been working on an open source project for awhile, http://gtkworkbook.sourceforge.net/, and recently ran into an issue that just seems like I am going in circles. I'm pretty sure there is a heap problem but I have been looking at this code too long to figure out exactly what it is.
So, in brief, what I am doing is reallocating a...
Which datasource best supports multi-threading in Spring?
...
i am encountering a weird scenario,
Is there a possibility of JVM re-using an already created object when we are initializing a new one and the object count is JVm is very high?
abc a = new abc();
a.setAttribute("aaaa");
.........
a...is no longer being used...and has not yet been garbage collected by the JVM. There are multiple threads...
Hi guys,
My application crashes on this line
[NSThread detachNewThreadSelector: @selector(getJSON:) toTarget:self withObject:nil];
Here is how the getJSON funciton looks like:
- (void)getJSON: (NSDate *)startTime endTime:(NSDate *)endTime;
What it the problem?
...
Do you have any advices how to test a multithreaded application?
I know, threading errors are very difficult to catch and they may occur at anytime - or not at all. Tests are difficult and the results are never for sure. Certainly it is best to carefully design and program the concurrent modules.
Nevertheless - I do not want to leave ou...
Hi all.
I have implemented a multithreaded crawler in C#.
Using a custom threadpool, there's a job queue, all pages to be downloaded are queued up and each thread takes one and downloads.
using 15 threads,
When crawling one site only, it's smooth as silk and gets done fast.
When crawling several sites on different servers at the sam...
Is there a way to run a heavy operation in shoes in a different thread so that the GUI is not freezing until the operation is finished? (smth. similar to download but more generic, like SwingWorker.class in Swing).
I have tried the following:
Thread.start { <heavy operation block is here> }
but that didn't help. looks like Shoes main...