Tuesday, October 13, 2009

Reentrancy

i disagree with the author's statement that reentrancy implies thread safety. thread safety requires avoiding race conditions. given the definition thread A and thread B cannot share inputs that are changeable. race conditions require thread A putting a lock on resource X and thread B putting a lock on resource Y and each thread needing the others resource. i recall two threads reading the same location at the same time can lead to unexpected results. these resources are immutable but could cause issues. this is not going to a common case by any means. i can't think of a reason you would need two read locks open simultaneously on separate pieces of "static" data but it does break the author's statement.

No comments:

Post a Comment