A
Alessandro Giambruno
Hi to all...
and first of all THANX to have answered me last time...
I had this problem:
"Mine is a very stupid problem, but i can't already solve it. A lot of times
i need to make my main class WAIT (until a certain number of seconds or a
change in variable content). I cannot apply an Listener because i don't need
user interaction.
If i make a While(true){ ...break when timer finish... } or
While(timer control) { empty }
i have a "little" problem: my class will use 100% of my Cpu in a cycle
(notwithstanding i do nothing inside the while).
I'd like to have a command like "wait" in old Basic...i cannot solve my
problem in other way.
I don't use multithreading, so i can't imagine to use wait...run commands in
multithreading. Also i think i can find a easier solution
Lots of kisses to all programmers...."
and u answered me that Thread.sleep(m) could be a solution.
I need another thing:
is there a method like Sleep but that finishes his "sleeping" after a
CHANGE of VARIABLE CONTENT? (i.e. int a-->sleep-->a=2-->run)
THANX A LOOT
_____________________________________
"Heard melodies are sweet,
but those unheard are sweeter;
therefore, ye soft pipes, play on,
- Not to the sensual ear, but, more endear'd,
Pipe to the spirit ditties of no tone."
(J. Keats, "Ode on a Grecian Urn")
and first of all THANX to have answered me last time...
I had this problem:
"Mine is a very stupid problem, but i can't already solve it. A lot of times
i need to make my main class WAIT (until a certain number of seconds or a
change in variable content). I cannot apply an Listener because i don't need
user interaction.
If i make a While(true){ ...break when timer finish... } or
While(timer control) { empty }
i have a "little" problem: my class will use 100% of my Cpu in a cycle
(notwithstanding i do nothing inside the while).
I'd like to have a command like "wait" in old Basic...i cannot solve my
problem in other way.
I don't use multithreading, so i can't imagine to use wait...run commands in
multithreading. Also i think i can find a easier solution
Lots of kisses to all programmers...."
and u answered me that Thread.sleep(m) could be a solution.
I need another thing:
is there a method like Sleep but that finishes his "sleeping" after a
CHANGE of VARIABLE CONTENT? (i.e. int a-->sleep-->a=2-->run)
THANX A LOOT
_____________________________________
"Heard melodies are sweet,
but those unheard are sweeter;
therefore, ye soft pipes, play on,
- Not to the sensual ear, but, more endear'd,
Pipe to the spirit ditties of no tone."
(J. Keats, "Ode on a Grecian Urn")