Thread Subject: I just want to yeild a the current code thread :(

Subject: I just want to yeild a the current code thread :(

From: Lucas

Date: 10 Jun, 2009 19:08:01

Message: 1 of 3

so... the title says it all really.

Basically, the shortest period you can pause for is 0.001s (1 millisecond) - i dont think it is conicedence that the smallest period javas Thread.wait(int) produces is also 0.001s.

I just want it to update a figure and not have to wait an extra millisecond every time. Is there a good way around this, call an empty script? can't pause just have an option for Thread.yield().

Subject: I just want to yeild a the current code thread :(

From: Ulf Graewe

Date: 10 Jun, 2009 19:18:01

Message: 2 of 3

instead of using:
plot(x,y)
pause(0.001)

use simply:
plot(x,y)
drawnow

doc drawnow

Subject: I just want to yeild a the current code thread :(

From: Lucas

Date: 10 Jun, 2009 19:50:18

Message: 3 of 3

good solution - one to remember.

What if I add in a java object that starts its own thread - will 'drawnow update' cause the program to yield to that thread? This is my real worry.

I guess I can write some code to figure it out.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
pause Lucas 10 Jun, 2009 15:09:02
rssFeed for this Thread

Contact us at files@mathworks.com