This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The code is taken directly from Dr. K's book. Mutex class creates two threads: Pusher and Popper.
MY QUESTION: The output of the code is: Exit from main(). Pushed: true Popped: null What I can't understand is why is popped null. First, I thought maybe because the JVM did a context switch in the middle of incrementing toOfStack, but then I put in System.out statements and there was no context switch during ++topOfStack.
Here is the code:
Joined: Jun 10, 2004
the smiley face shouldn't be there: the for loop is an infinite loop.