about pausing of execution
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
hi ,
is there any way to pause execution of a part of java program for a particular time without using Thread.sleep() method
thanks,
bye
kalyan
is there any way to pause execution of a part of java program for a particular time without using Thread.sleep() method
thanks,
bye
kalyan
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi,
Well, there is Thread.suspend, but it's deprecated. Anyway, why would
you like to do that? (I mean, your question is quite vague. Tell us more
and we might be able to help.)
Petr
Well, there is Thread.suspend, but it's deprecated. Anyway, why would
you like to do that? (I mean, your question is quite vague. Tell us more
and we might be able to help.)
Petr
Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
kalyan at tcs
Greenhorn
Posts: 8
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
hi
in my program , iam having 2 methods which display screens on screen ,
and iam calling them sequentially , hence iam not able to see the output of first method .so i want to pause execution of my program for some time at end of first method and before the second , so that i can view outputs of both
i was restricted not to use Thread concept , pls help me , is there is any other way to over come this
bye
kalyan
in my program , iam having 2 methods which display screens on screen ,
and iam calling them sequentially , hence iam not able to see the output of first method .so i want to pause execution of my program for some time at end of first method and before the second , so that i can view outputs of both
i was restricted not to use Thread concept , pls help me , is there is any other way to over come this
bye
kalyan
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
You could put in code that waits for some user input before proceeding, a bit like C's getch()
For example,
displays 'Hello', and then waits for the user to press Enter, before displaying 'World'.
Would this solve your problem?
For example,
displays 'Hello', and then waits for the user to press Enter, before displaying 'World'.
Would this solve your problem?
The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
Tweets
kalyan at tcs
Greenhorn
Posts: 8
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
hello,
i had nothing to input from user
bye
kalyan
i had nothing to input from user
bye
kalyan
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
This is pretty ugly, and pretty much locks up the app, but you could do:
kalyan at tcs
Greenhorn
Posts: 8
posted 21 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
hi Jason Fox ,
thanks for ur help
bye
kalyan
thanks for ur help
bye
kalyan
posted 21 years ago
This is a rather vague restriction. Does this mean you can't use threads? If so, you can't start a JVM (which uses threads), and therefore, the problem is outside the scope of Java.
Does it mean you can't use the java.lang.Thread API? If so, perhaps your teacher is hinting at the use of Object wait/notify/notifyAll.
It is important to note that you can NEVER have a thread pause for a specific period of time - you can however, have a thread pause for at least a specific period of time. When that thread comes out of 'sleep' state it is put into 'ready for execution' state - not 'running' state. It is up to the indeterminate thread scheduler to decide when the thread is shifted to 'running' state.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i was restricted not to use Thread concept
This is a rather vague restriction. Does this mean you can't use threads? If so, you can't start a JVM (which uses threads), and therefore, the problem is outside the scope of Java.
Does it mean you can't use the java.lang.Thread API? If so, perhaps your teacher is hinting at the use of Object wait/notify/notifyAll.
It is important to note that you can NEVER have a thread pause for a specific period of time - you can however, have a thread pause for at least a specific period of time. When that thread comes out of 'sleep' state it is put into 'ready for execution' state - not 'running' state. It is up to the indeterminate thread scheduler to decide when the thread is shifted to 'running' state.
Tony Morris
Java Q&A (FAQ, Trivia)
| Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |










