Hi I think what you mean is for example your sending an HTTP Request to a 
server then ur client is blocking waiting for the responde of the server so how 
you can stop or close the blocking state?  You can shutdown the connection of 
the socket actually but provided if when you send the http request it is on a 
separate thread from the UI..meaning from the you UI thread u can call the 
shutdown...example:

    onResume(...)
    {
       this.mClient = new DefaultHttpClient();
       new Thread( new Runnable()
       {
           myBlockingFunction();
       }).start();
    }

    aBlockingFunction(...)
    {
        try
        {
        ...
           http client communicates with http server here( possible will be in 
blocking state if network is not good )
        }
        catch( IOException e )
        {
            ...
        }
        catch( Other Exceptions here )
        {
            ...
        }
    }
    onStop()
    {
        this.mClient.getConnectionManager.shutdown();  //triggers to send an 
IOException if the client is on a blocking state so better catch the IOException
    }

 Hope this helps.

- Brian

--- On Fri, 1/29/10, redders <[email protected]> wrote:

From: redders <[email protected]>
Subject: [android-developers] How do I kill a blocking thread?
To: "Android Developers" <[email protected]>
Date: Friday, January 29, 2010, 4:59 AM

I have a thread listening on a TCP port. When there's nothing coming
in on that port, the thread blocks. This is fine, and the behaviour I
want, but how do I kill said thread while it's blocking?

-- 
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



      

-- 
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