Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a C# Add-In for a UML modelling product that automatically draws diagrams and maintains them. I am processing larger scale enterprise models with over 6000 diagrams. This takes a long time (even on faster machines). So I created a version that uses the Background worker thread to run the "batch" portion of the job while the "foreground" has a modal dialogue that allows me to stop the processing early. Otherwise, due to the UI of the modelling program I can't send the "STOP" message to the Add-In.

The background version seems to take twice as long as the single thread version. Actually, I was expecting that the background worker thread version would be multi-threaded but from what probing I have been able to do it's not actually running in a separate thread.

The Modal dialog and the Add-In communicate correctly so the two pieces of functionality appear to be on separate threads. The batch runs under .RunWorkerAsync() through the DoWork method. But if I place traces in the code they report that there are not running on separate threads (since .Invoke Required is set to false).

I would have expected a small amount of overhead, but not this much (100%).

What's going on? Should I be moving to true multi-threading (as opposed to BackgroundWorker)?

TIA, Paolo

share|improve this question
1  
This question seems more suited for stackoverflow.com . – bobbymcr Nov 28 '11 at 6:11
Yes, After I posted, I realised that. I have reposted there. Should I delete from here? Do I have the rep to do that? – PaoloFCantoni Nov 28 '11 at 7:06
1  
Don't ever repost anything on these sites. It will just annoy users, this time those on SO, once we migrate this question. How difficult is it to flag for moderator attention and wait for a few minutes? – Daniel Beck Nov 28 '11 at 7:09
Well first (as an infrequent and naive user) I didn't even know about flag for moderator. Presumably bobbymcr didn't know about it either - since he didn't suggest it. Still, now I know and will try to remember in future. – PaoloFCantoni Nov 29 '11 at 1:29

closed as off topic by shf301, heavyd, Daniel Beck, slhck, RedGrittyBrick Nov 28 '11 at 10:33

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.