{"action":"created","issue":{"url":"https://api.github.com/repos/benediktschmitt/py-filelock/issues/3","labels_url":"https://api.github.com/repos/benediktschmitt/py-filelock/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/benediktschmitt/py-filelock/issues/3/comments","events_url":"https://api.github.com/repos/benediktschmitt/py-filelock/issues/3/events","html_url":"https://github.com/benediktschmitt/py-filelock/issues/3","id":80286775,"number":3,"title":"using with and providing a timeout","user":{"login":"benprew","id":37847,"avatar_url":"https://avatars.githubusercontent.com/u/37847?v=3","gravatar_id":"","url":"https://api.github.com/users/benprew","html_url":"https://github.com/benprew","followers_url":"https://api.github.com/users/benprew/followers","following_url":"https://api.github.com/users/benprew/following{/other_user}","gists_url":"https://api.github.com/users/benprew/gists{/gist_id}","starred_url":"https://api.github.com/users/benprew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benprew/subscriptions","organizations_url":"https://api.github.com/users/benprew/orgs","repos_url":"https://api.github.com/users/benprew/repos","events_url":"https://api.github.com/users/benprew/events{/privacy}","received_events_url":"https://api.github.com/users/benprew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-24T22:10:42Z","updated_at":"2015-05-24T22:26:58Z","closed_at":null,"body":"I'd like to be able to use the `with` and specify a timeout.\r\n\r\nDoing this:\r\n\r\n```        \r\nwith self.lock.acquire(timeout=10):\r\n```\r\n\r\nResults in a nested lock (since `__enter__` acquires a lock too).  I couldn't see a way to do this without explicitly releasing the lock.\r\n\r\nAny suggestions for how to use with and timeout together?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/benediktschmitt/py-filelock/issues/comments/105071996","html_url":"https://github.com/benediktschmitt/py-filelock/issues/3#issuecomment-105071996","issue_url":"https://api.github.com/repos/benediktschmitt/py-filelock/issues/3","id":105071996,"user":{"login":"benediktschmitt","id":5073305,"avatar_url":"https://avatars.githubusercontent.com/u/5073305?v=3","gravatar_id":"","url":"https://api.github.com/users/benediktschmitt","html_url":"https://github.com/benediktschmitt","followers_url":"https://api.github.com/users/benediktschmitt/followers","following_url":"https://api.github.com/users/benediktschmitt/following{/other_user}","gists_url":"https://api.github.com/users/benediktschmitt/gists{/gist_id}","starred_url":"https://api.github.com/users/benediktschmitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benediktschmitt/subscriptions","organizations_url":"https://api.github.com/users/benediktschmitt/orgs","repos_url":"https://api.github.com/users/benediktschmitt/repos","events_url":"https://api.github.com/users/benediktschmitt/events{/privacy}","received_events_url":"https://api.github.com/users/benediktschmitt/received_events","type":"User","site_admin":false},"created_at":"2015-05-24T22:26:58Z","updated_at":"2015-05-24T22:26:58Z","body":"At the moment, there is no other way. Would a fix of issue #2 help you?\r\n\r\nThere would still be the problem with providing a timeout value in the with statement. I don't want to change the behavior of the *acquire* method for backward compatibility, but I could implement the `__call__` method to allow you doing this:\r\n```python\r\nwith self.lock(timeout = 10):\r\n```\r\n\r\nI'm open for any ideas."}}