Merge pull request #4 from deztructor/master

Fixed race condition in poll implementation