INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Threading in .NET  (Read 1322 times)

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Threading in .NET
« on: December 11, 2004, 05:40:17 am »

Howdy folks...

First off, I've written multi-threaded apps using Posix-Threads before, so I'm not a complete threading n00b :)

Anyway, I'm updating my old MC XML Export plugin, which is single-threaded and uses yukky hacks to make it look multi-threaded :) However, I want this new version to use a separate threads so I can remove the GUI from the back end and have things like status-bars and cancel buttons and all that nice fluff.

I'm using C# .NET and I'm finding that when I put my export code into a separate thread (using System.Threading) it runs about 10x slower than running it in the same thread as the GUI, which is obviously quite a pain.

I was wondering if anyone's had any experience with threading in .NET and knows why this is happening.

Basically it goes like this:

ex = new Exporter(blahblah);
ts = new System.Threading.ThreadStart(ex.doExport);
t = new System.Threading.Thread(ts);
t.start();

Nothing wrong with that, right? However, the doExport method takes about ten times longer when doing it that way than when just going:

ex = new Exporter(blahblah)
ex.doExport()

However that leaves me with a completely un-usable GUI, which is dumb.

Any ideas?

Thanks,

Scott.
Logged
Pages: [1]   Go Up