Methods and apparatus for enabling the association between a monitor and
an object to be maintained when a garbage collection occurs during a wait action
performed with respect to the object are disclosed. According to one aspect of
the present invention, a method for acquiring access to an object in a multi-threaded,
object-based system includes associating a monitor with the object, and setting
a pointer from a thread, which is arranged to execute on the object, to the object.
The method also includes setting a reference substantially directly from the thread
to the monitor. In one embodiment, setting the reference includes setting a boolean
reference count. In another embodiment, setting the reference enables a garbage
collector to determine whether the monitor is suitable for reclamation during a
garbage collection process.