Methods and apparatus for enabling inconsistent or unsafe threads to
efficiently reach a consistent or safe state when a requesting thread
requests a consistent state are disclosed. According to one aspect of the
present invention, a method for requesting a consistent state in a
multi-threaded computing environment using a first thread includes
acquiring a consistent state lock using the first thread, and identifying
substantially all threads in the environment that are inconsistent. The
state of the inconsistent threads is altered to a consistent state, and
the first thread is notified when the states of the previously
inconsistent threads have been altered to be consistent. Once the first
thread is notified, the first thread releases the consistent state lock.
In one embodiment, the method also includes performing a garbage
collection after releasing the consistent state lock using the first
thread.