[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why to interrupt blocked socket? - Re: No message for 6 months



Why do you let any thread be block at any socket, more accurately, 
at any stream? To avoid being blocked, Method available() of the 
stream should be called before read(XXX) in a synchronized method 
or block. 

Shengru

>From: "Beton, Richard" <richard.beton@xxxxxxxxxx>
>To: occam-com mailing list <occam-com@xxxxxxxxx>
>Cc: Java-Threads Mailing List <java-threads@xxxxxxxxx>

...

>Ping! Yep, still here and busy as ever.
>
>Am currently happily 'struggling' with a bit of JCSP. One thread reads 
>from a socket and may be blocked and I want to be able to interrupt it 
>cleanly. This is more difficult than I expected, so suggestions are 
>welcome (JCSP gets upset if you interrupt your threads, and with some 
>justification). Otherwise my bodge will have to suffice.
>
>Rick :-)
>

**----------------------------------------------------------------------**
| Dr. Shengru Tu, Associate Professor |  shengru@xxxxxxxxxx              |
| Computer Science Department         |  (504) 280 - 7108 (Voice)        |
| University of New Orleans           |            - 7228 (Fax)          |
| 2000 Lakeshore Drive                |                                  |
| New Orleans, LA 70148               |  http://www.cs.uno.edu/~shengru  |
**----------------------------------------------------------------------**