Threading problem, marshalled callback flakey

T

Tim Ryter

Greetings,

Please excuse my newbieness up front, I am very new to developing complex
applications, and am finding myself banging my head against the desk
regularly. :)

What I am basically trying to do is spinup a thread off the main UI thread.
This thread uses a delegate to communicate with the UI thread. This thread
does some intense processing in a loop, and at the end of every loop it
pings the UI thread to update a progressbar. It "does" work, but it's
really unreliable. For instance, sometimes the progressbar is updated, but
then it's like the UI thread locks up for a moment (says not responding in
the titlebar, etc) and sometimes it will come back and update the bar,
sometimes not. The new thread I spawned however, never seems to be
affected.

Is it possible that what I'm trying to do in the second thread is just too
much for the computer to handle? All it's doing it ripping a CD, one track
at a time (each loop rips one track). My computer is a P4 2.4 800 FSB and
in hyperthreading mode. If I boot with hyperthreading turned off, the
program is even less stable.

Any help would be appreciated.

TIA
 
T

Tom Shelton

Greetings,

Please excuse my newbieness up front, I am very new to developing complex
applications, and am finding myself banging my head against the desk
regularly. :)

What I am basically trying to do is spinup a thread off the main UI thread.
This thread uses a delegate to communicate with the UI thread. This thread
does some intense processing in a loop, and at the end of every loop it
pings the UI thread to update a progressbar. It "does" work, but it's
really unreliable. For instance, sometimes the progressbar is updated, but
then it's like the UI thread locks up for a moment (says not responding in
the titlebar, etc) and sometimes it will come back and update the bar,
sometimes not. The new thread I spawned however, never seems to be
affected.

Is it possible that what I'm trying to do in the second thread is just too
much for the computer to handle? All it's doing it ripping a CD, one track
at a time (each loop rips one track). My computer is a P4 2.4 800 FSB and
in hyperthreading mode. If I boot with hyperthreading turned off, the
program is even less stable.

Any help would be appreciated.

TIA

With out seeing code - I would guess that your are trying to access the
GUI directly from your background thread... This is a big no-no.

Here is a link to the first part of a 3 part article on the subject:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms08162002.asp

The other two parts are listed in the sidebar... The code is in C#, but
the concepts are the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top