Code examples from my blog http://deadlockblog.co