Skip to content

Instantly share code, notes, and snippets.

View greghmerrill's full-sized avatar

Greg Merrill greghmerrill

View GitHub Profile
@greghmerrill
greghmerrill / StopThreadWhileAcquiringLock.java
Created August 31, 2011 13:46
Illustrates the fact that Thread.stop() won't immediately stop a Thread which is waiting to acquire a lock
/**
This illustrates the fact that calling stop() on a Thread
won't stop the Thread if it's waiting on a monitor.
The output I get is:
Thread t1 acquiring lock
Thread t1 has lock
Thread t2 acquiring lock
...waits forever...