Another guess - start() immediately followed by join().

-- Kostya

28.10.2010 23:35, DanH пишет:
Lemme guess:  You created a Thread but you never started it.

On Oct 28, 1:42 pm, Hank<[email protected]>  wrote:
In my code, I don't have "wait" or "block" in the main thread, but in
the child thread. So supposedly only the child thread should "wait" or
"block".

On Oct 28, 2:37 pm, DanH<[email protected]>  wrote:

The problem is that you should never "wait" or "block" in the main
thread.  Your background thread needs to somehow notify the main
thread that the connection is ready, and until then the main thread
should be "spinning" (in the figurative sense) in its event loop, not
sitting on a "wait".
On Oct 28, 1:08 pm, Hank<[email protected]>  wrote:
Within my service I created a new thread that will try to establish a
internet connection, and I want it to wait for the connection to be
established before doing anything. But when I call wait() or use
ConditionalVariable.block(), it blocks the whole application and
causes ANR. Does anybody know why it does that even though I created a
child thread for this task? and do you have any solutions for this
problem?


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to