[plt-scheme] concurrent modification of hashtables

From: David A. Herman (dherman at ccs.neu.edu)
Date: Fri May 30 16:55:02 EDT 2003

Helpdesk mentions concurrent modification of hash-tables in the presence
of multiple threads, but it doesn't talk about patterns such as:

(define (hash-table-filter! t p)
  (hash-table-for-each t
    (lambda (key value)
      (unless (p key value)
        (hash-table-remove! t key)))))

In other words, can a function currently iterating across a hashtable
safely modify the current entry it's observing? (A Java analog would be
java.util.Iterator.remove().)

Thanks,
Dave


Posted on the users mailing list.