We often require a main thread of a application to keep waiting (and not end).
For Console applications, we can just block with a Console.Read() method.
For other applications, we tend to write a infinite loop like -- while(true){}
But the above statement keeps on wasting a lot of computational cycles.
A much cleaner and cool approach would be :--
java.lang.Object sync = new java.lang.Object();
synchronized (sync) { sync.wait(); }
Friday, June 17, 2005
Subscribe to:
Post Comments (Atom)
Hey Naren,
ReplyDeleteThat is cool way to keep a JVM alive! liked it.
I like your blog. Keep posting.