Greetings! This might be more appropriate for the threading forum, but I thought I'd try here first
I have an assignment on threads that's due in about 7 hours. My instructor knows I swear by JavaRanch, and I'm asking him the same question, but I'm hoping someone here might have an idea
The lab is supposed to be an application of
Sun's Producer/Consumer Example, but there seems to be something I'm missing.
Here's the output, which hangs after the last line displayed here:
***Train number in the SET method is 1
Train 1 created
***Train number in the SET method is 2
Train 2 created
***Train number in the SET method is 3
Train 3 created
***Train number in the SET method is 4
Train 4 created
Train 1 waiting to enter the tunnel
Train 2 waiting to enter the tunnel
Train 3 waiting to enter the tunnel
Train 4 waiting to enter the tunnel
<snipped for lab integrity>
I notice, when looking at the Produce/Consumer portion of Sun's site, that
the get() returns a value after notifyAll().
When running in Debug through Netbeans, it looks like "available" never gets
touched, but I can't see why. Is it b/c I'm not doing a return? I can't figure out why it's just hanging.
Can anyone offer suggestions or advice?
Thanks!
[ July 09, 2004: Message edited by: dav mccartney ]