added threads API
Merge pull request #13 from tbenade/master

Looks ok to me, thanks.