Lock support

Do you have any suggestions for API? 
here test will fail because there is no global event loop (the `loop` argument should be passed explicitly).