On Fri, Jun 26, 2009 at 03:38:31AM -0700, Alexander Monakov wrote: > 1. Add bool field `modified_p' in bitmap structure. > 2. Make iterator setup functions (e.g. bmp_iter_set_init) reset it to > false. > 3. Make functions that modify the bitmap set it to true. > 4. Make iterator increment function (e.g. bmp_iter_next) assert > !modified_p.
Sorry, it doesn't work. Function foo has a loop that iterates over a bitmap. During the iteration, it calls a function bar. bar modifies the bitmap, then iterates over the bitmap. It then returns to foo, which is in the middle of an iteration, which it continues. The bitmap has been modified (by bar), but modified_p was reset to false by the iteration that happened at the end of bar.