473,394 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Threading problem, marshalled callback flakey

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
Nov 21 '05 #1
1 981
On 2005-01-16, Tim Ryter <tmryter_at_hotmail.com> wrote:
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/de...ms08162002.asp

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

--
Tom Shelton [MVP]
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim West | last post by:
Good day all, Ok, I'm starting to get the hang of this Python thing...really pretty cool actually. Again, thanx to those that have helped me thus far. I now have another stumbling block to...
5
by: Francois De Serres | last post by:
Hiho, could somebody please enlighten me about the mechanics of C callbacks to Python? My domain is more specifically callbacks from the win32 API, but I'm not sure that's where the problem...
8
by: Z D | last post by:
Hello, I'm having a strange problem that is probably due to my lack of understanding of how threading & COM Interop works in a WinForms.NET application. Here's the situation: I have a 3rd...
2
by: JMax | last post by:
Hello! I have a question that I really can’t think of an answer for, but thought I might as well give a shot here. I have a web service, created by the VS web service creator. I have another...
10
by: Bryce Calhoun | last post by:
Hello, First of all, this is a .NET 1.1 component I'm creating. SUMMARY ----------------------- This component that I'm creating is, for all intents and purposes, a document parser (I'm...
6
by: hzgt9b | last post by:
Using VS 2003, .NET: I developed a windows application that performs several actions based on an input file. The application displays a progress bar as each action executes. Based on new...
8
by: Luc | last post by:
Hi, I am writing software to automate some testing. I have one main form to set up the tests, and once this is complete, I open 4 identical forms to monitor each different device that I am...
7
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has...
2
by: Mike P | last post by:
I am using the following code, what I need to know is, what do I do if I want to pass parameters to DoSomeWork? I don't understand how the callback variable is passed to DoSomeWork. private...
3
by: ropo | last post by:
I have a managed wrapper class that has a delegate to be called from unmanaged code: public ref class CmmMessageCallbackWrapper { private: delegate void InternalMessageDelegate( void*,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.