Interview Question

Interview Redmond, WA

Having a stack that's thread safe, if the pop() method goes

  inside the if clause and context switches right before throwing an EmptyStack exception, when it context switches, and in the context switch a value is pushed into that stack, it will throw the EmptyStack exception even though it's not empty. How do you fix this?

Add Answers or Comments

To comment on this, Sign In or Sign Up.