Debug/Release problems 
Author Message
 Debug/Release problems

i made an app compiled it ran it in the ide, it worked fine.

i changed the bit at the top from debug to release, run it again in the ide
its fine, now when i run it outside the ide it seems to never let a timer
event complete, change it back to debug and run it out side the ide its fine
:-/

all it does is generate a small delay (500ms)

private void wait(int ms)
{
    System.Timers.Timer wTimer = new System.Timers.Timer();
    wTimer.Elapsed+=new ElapsedEventHandler(OnWaitEvent);

    hold = true;
    wTimer.Interval = ms;
    wTimer.AutoReset = false;

    wTimer.Start();

    while(hold)
    {
        //do nothing
    }

    wTimer.Stop();

Quote:
}

private void OnWaitEvent(object o, ElapsedEventArgs arg)
{
    hold = false;

Quote:
}

any ideas?? also is there an easier way of pausing execution of the main
thread??


Sun, 12 Jun 2005 00:42:03 GMT  
 Debug/Release problems


Quote:
> i made an app compiled it ran it in the ide, it worked fine.

> i changed the bit at the top from debug to release, run it again in
the ide
> its fine, now when i run it outside the ide it seems to never let a
timer
> event complete, change it back to debug and run it out side the ide
its fine
> :-/

> all it does is generate a small delay (500ms)

>     wTimer.Start();

>     while(hold)
>     {
>         //do nothing
>     }

>     wTimer.Stop();
> }

> private void OnWaitEvent(object o, ElapsedEventArgs arg)
> {
>     hold = false;
> }

> any ideas?? also is there an easier way of pausing execution of the
main
> thread??

I'm not sure what your debug/release problem is, but there is absolutely
a better way to pause a thread.

Having a tight while() loop is bad because it pegs the processor.

You need to do System.Threading.Thread.Sleep(500).

You can also call Sleep() which will merely yield the rest of that
thread's timeslice.

-c



Sun, 12 Jun 2005 00:59:09 GMT  
 Debug/Release problems
thanks, now it works fine in release outside the ide.


Quote:



> > i made an app compiled it ran it in the ide, it worked fine.

> > i changed the bit at the top from debug to release, run it again in
> the ide
> > its fine, now when i run it outside the ide it seems to never let a
> timer
> > event complete, change it back to debug and run it out side the ide
> its fine
> > :-/

> > all it does is generate a small delay (500ms)

> >     wTimer.Start();

> >     while(hold)
> >     {
> >         //do nothing
> >     }

> >     wTimer.Stop();
> > }

> > private void OnWaitEvent(object o, ElapsedEventArgs arg)
> > {
> >     hold = false;
> > }

> > any ideas?? also is there an easier way of pausing execution of the
> main
> > thread??

> I'm not sure what your debug/release problem is, but there is absolutely
> a better way to pause a thread.

> Having a tight while() loop is bad because it pegs the processor.

> You need to do System.Threading.Thread.Sleep(500).

> You can also call Sleep() which will merely yield the rest of that
> thread's timeslice.

> -c



Sun, 12 Jun 2005 01:44:23 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Debug-Release Problem.

2. debug/release problems

3. GDI debug - release problems

4. ActiveX and debug/release problems

5. VC6 Debug/Release problem

6. Helps need on adding debug info to release mode so to debug release code

7. no problem with the debug version but problem with the release one

8. COM Debug/Release CRT DLL Problem

9. Debug version ok but release version problem

10. Debugging AddRef/Release problems with ATL

11. Debug vs Release problems

12. Debug , Release exe problem

 

 
Powered by phpBB® Forum Software