RE: JavaMemoryModel: Thread model algorithm.

From: David Holmes (dholmes@dltech.com.au)
Date: Tue Nov 18 2003 - 17:37:45 EST


Jerry,

> Unfortunately it doesn't force programmers to do anything.

Okay. Knowing that spurious wakeups can occur the programmer should
realize (or at least understand why he/she was told) that waiting
should always be done in a loop. It raises the awareness.

If spurious wakeups aren't allowed the programmer is more likely to
code an "if (!condition) wait() ..." rather than a "while (!condition)
wait() ..." even in circumstances where the "if" is incorrect without
spurious wakeups.

Using a while loop is never wrong. Using if often is.

David Holmes

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:54 EDT