Thread: Question about background workers

  1. #1
    Registered User
    Join Date
    Nov 2006

    Question about background workers

    I have a breadth first search that I've been toying with for a bit, and it works very well. The problem is, that if it has to perform more than a certain number of comparisons it freezes my computer. I tried adding a backgroundWorker but it never completes the function. It enters, according to the various break points I've added but never completes it. Is there a certain amount of code that a background worker will do or is there more that I need to add then the following:

                  //various setups for the search 
                    backgroundWorker1.DoWork += new          doWorkEventHandler(backgroundWorker1_DoWork);
    private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)

    all the variables are global so it shouldn't be a problem with variable passing. Any help would be very appreciated.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Visalia, CA, USA
    Perhaps the problem lies in you are calling the function you are calling, not the threads which you are creating. May we look at the function that is causing the hang, por favor.

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    There is a ProgressChanged event that's triggered when you call "ReportProgress(int progress, obj result)" within the DoWork event and can constantly update the status of the calculation. You can then set flags and cancel it with CancelAsync method.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. Windows background color
    By Exile in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2005, 07:55 AM
  3. Detect Close of a background process
    By Schwarzhelm in forum C Programming
    Replies: 1
    Last Post: 11-05-2003, 01:46 AM
  4. Allegro Question..
    By o0obruceleeo0o in forum Game Programming
    Replies: 3
    Last Post: 07-01-2003, 01:10 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM