Process works in step mode(debugging) only??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • trint

    Process works in step mode(debugging) only??

    I have a thread:

    ThreadStart myThreadDelegat e = new
    ThreadStart(Thr eadFunction1.ge tOneAtATime);
    Thread thr1 = new Thread(myThread Delegate);
    thr1.Start();

    then another function that only works if in debug mode...I thought it
    just needed slowing down, but that didn't work either.
    It happens in a do loop:

    do{ <--works only in debug mode.
    //do something
    Thread.Sleep(10 00);
    } while (couNTer1 == false);

    Any help is appreciated.
    Thanks,
    Trint

  • PMGuy

    #2
    Re: Process works in step mode(debugging) only??

    Need more information. What exactly isn't working?

    Commonly, when a threaded process works only in debug mode, it's
    because a dependent process gets ahead of it. It's a synchronization
    problem.

    But I'm not sure anyone will be able to help you without having more
    information about the problem.

    Comment

    • trint

      #3
      Re: Process works in step mode(debugging) only??

      I want it to stay in this do loop, but if it isn't in debug "stepping",
      it breaks on it's own:

      bool couNTer1 = false;
      do
      {
      Form1 findThread = new Form1();
      findThread.labe l15.Text = ("0" + " Invoices Left to Print");
      findThread.load InvoiceContaine r();
      findThread.labe l15.Text = (Convert.ToStri ng(Class1.cI) + "
      Invoices Left to Print");
      findThread.butt on7.Text = "&Watching for New Invoices";


      if(Class1.cI > 0)
      {
      findThread.goto Foreach();
      }
      } while (couNTer1 == false);
      Thanks,
      Trint

      Comment

      • Adam Clauss

        #4
        Re: Process works in step mode(debugging) only??

        "trint" <trinity.smith@ gmail.com> wrote in message
        news:1118058241 .628907.170940@ g47g2000cwa.goo glegroups.com.. .[color=blue]
        >I want it to stay in this do loop, but if it isn't in debug "stepping",
        > it breaks on it's own:
        >
        > bool couNTer1 = false;
        > do
        > {
        > Form1 findThread = new Form1();
        > findThread.labe l15.Text = ("0" + " Invoices Left to Print");
        > findThread.load InvoiceContaine r();
        > findThread.labe l15.Text = (Convert.ToStri ng(Class1.cI) + "
        > Invoices Left to Print");
        > findThread.butt on7.Text = "&Watching for New Invoices";
        >
        >
        > if(Class1.cI > 0)
        > {
        > findThread.goto Foreach();
        > }
        > } while (couNTer1 == false);
        > Thanks,
        > Trint[/color]


        Well, for that loop to break out, couNTer1 has to be true. I don't even see
        where that happens here... you must have something else going on that you
        haven't shown us.

        --
        Adam Clauss
        cabadam@tamu.ed u


        Comment

        • trint

          #5
          Re: Process works in step mode(debugging) only??

          There is no break in any function within the do loop.
          Does a thread have to be told to continue working?
          Trint

          Comment

          • Ignacio Machin \( .NET/ C# MVP \)

            #6
            Re: Process works in step mode(debugging) only??

            Hi,

            What is what you want to do?
            A thread will live as long as the method being executed is running, when it
            ends the thread cease of exist.

            It seems that you want to do some processing in the background as wait for
            invoices & print them.

            How the invoices are received? Have you tried the FileWatcher class?

            cheers,

            --
            Ignacio Machin,
            ignacio.machin AT dot.state.fl.us
            Florida Department Of Transportation



            "trint" <trinity.smith@ gmail.com> wrote in message
            news:1118059953 .441880.292980@ g14g2000cwa.goo glegroups.com.. .[color=blue]
            > There is no break in any function within the do loop.
            > Does a thread have to be told to continue working?
            > Trint
            >[/color]


            Comment

            • Trint Smith

              #7
              Re: Process works in step mode(debugging) only??

              I figured it out...I was trying to access a UI control in one of the
              functions.
              Thanks,
              Trint

              .Net programmer
              trinity.smith@g mail.com

              *** Sent via Developersdex http://www.developersdex.com ***

              Comment

              • Willy Denoyette [MVP]

                #8
                Re: Process works in step mode(debugging) only??


                "trint" <trinity.smith@ gmail.com> wrote in message
                news:1118059953 .441880.292980@ g14g2000cwa.goo glegroups.com.. .[color=blue]
                > There is no break in any function within the do loop.
                > Does a thread have to be told to continue working?
                > Trint
                >[/color]
                So you endlessly (or until it crashes!) create instances of Form1, call
                loadInvoiceCont ainer() and possibly (if Class1.cI != 0) you call
                gotoForeach().
                I suppose "Class1.cI" is set to non-zero in your background thread, but
                before this one gets a chance to run you might have run the loop a thousands
                times, simply wasting CPU and memory resources, until it crashes, right?.

                Willy.



                Comment

                Working...