{"action":"created","comment":{"url":"https://api.github.com/repos/launchdarkly/python-client/pulls/comments/38971037","id":38971037,"diff_hunk":"@@ -0,0 +1,39 @@\n+import threading\n+\n+class ReadWriteLock:\n+    \"\"\" A lock object that allows many simultaneous \"read locks\", but\n+    only one \"write lock.\" \"\"\"\n+\n+    def __init__(self):\n+        self._read_ready = threading.Condition(threading.Lock())\n+        self._readers = 0\n+\n+    def rlock(self):\n+        \"\"\" Acquire a read lock. Blocks only if a thread has\n+        acquired the write lock. \"\"\"\n+        self._read_ready.acquire()\n+        try:\n+            self._readers += 1\n+        finally:\n+            self._read_ready.release(  )\n+\n+    def runlock(self):\n+        \"\"\" Release a read lock. \"\"\"\n+        self._read_ready.acquire()\n+        try:\n+            self._readers -= 1","path":"ldclient/rwlock.py","position":24,"original_position":24,"commit_id":"e5b00d8cbfefddd0775395da09c6c9b14e849ed6","original_commit_id":"e5b00d8cbfefddd0775395da09c6c9b14e849ed6","user":{"login":"pkaeding","id":13951,"avatar_url":"https://avatars.githubusercontent.com/u/13951?v=3","gravatar_id":"","url":"https://api.github.com/users/pkaeding","html_url":"https://github.com/pkaeding","followers_url":"https://api.github.com/users/pkaeding/followers","following_url":"https://api.github.com/users/pkaeding/following{/other_user}","gists_url":"https://api.github.com/users/pkaeding/gists{/gist_id}","starred_url":"https://api.github.com/users/pkaeding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkaeding/subscriptions","organizations_url":"https://api.github.com/users/pkaeding/orgs","repos_url":"https://api.github.com/users/pkaeding/repos","events_url":"https://api.github.com/users/pkaeding/events{/privacy}","received_events_url":"https://api.github.com/users/pkaeding/received_events","type":"User","site_admin":false},"body":"we should ensure that the number of readers is never negative.","created_at":"2015-09-08T19:49:30Z","updated_at":"2015-09-08T19:49:30Z","html_url":"https://github.com/launchdarkly/python-client/pull/17#discussion_r38971037","pull_request_url":"https://api.github.com/repos/launchdarkly/python-client/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/launchdarkly/python-client/pulls/comments/38971037"},"html":{"href":"https://github.com/launchdarkly/python-client/pull/17#discussion_r38971037"},"pull_request":{"href":"https://api.github.com/repos/launchdarkly/python-client/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/launchdarkly/python-client/pulls/17","id":44391678,"html_url":"https://github.com/launchdarkly/python-client/pull/17","diff_url":"https://github.com/launchdarkly/python-client/pull/17.diff","patch_url":"https://github.com/launchdarkly/python-client/pull/17.patch","issue_url":"https://api.github.com/repos/launchdarkly/python-client/issues/17","number":17,"state":"open","locked":false,"title":"Support for server-sent events","user":{"login":"jkodumal","id":19426,"avatar_url":"https://avatars.githubusercontent.com/u/19426?v=3","gravatar_id":"","url":"https://api.github.com/users/jkodumal","html_url":"https://github.com/jkodumal","followers_url":"https://api.github.com/users/jkodumal/followers","following_url":"https://api.github.com/users/jkodumal/following{/other_user}","gists_url":"https://api.github.com/users/jkodumal/gists{/gist_id}","starred_url":"https://api.github.com/users/jkodumal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkodumal/subscriptions","organizations_url":"https://api.github.com/users/jkodumal/orgs","repos_url":"https://api.github.com/users/jkodumal/repos","events_url":"https://api.github.com/users/jkodumal/events{/privacy}","received_events_url":"https://api.github.com/users/jkodumal/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-08T04:16:35Z","updated_at":"2015-09-08T19:49:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e28dc68bec0fe8f30642df1976ef50e21d92690","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/launchdarkly/python-client/pulls/17/commits","review_comments_url":"https://api.github.com/repos/launchdarkly/python-client/pulls/17/comments","review_comment_url":"https://api.github.com/repos/launchdarkly/python-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/launchdarkly/python-client/issues/17/comments","statuses_url":"https://api.github.com/repos/launchdarkly/python-client/statuses/e5b00d8cbfefddd0775395da09c6c9b14e849ed6","head":{"label":"launchdarkly:jko/sse","ref":"jko/sse","sha":"e5b00d8cbfefddd0775395da09c6c9b14e849ed6","user":{"login":"launchdarkly","id":8039656,"avatar_url":"https://avatars.githubusercontent.com/u/8039656?v=3","gravatar_id":"","url":"https://api.github.com/users/launchdarkly","html_url":"https://github.com/launchdarkly","followers_url":"https://api.github.com/users/launchdarkly/followers","following_url":"https://api.github.com/users/launchdarkly/following{/other_user}","gists_url":"https://api.github.com/users/launchdarkly/gists{/gist_id}","starred_url":"https://api.github.com/users/launchdarkly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/launchdarkly/subscriptions","organizations_url":"https://api.github.com/users/launchdarkly/orgs","repos_url":"https://api.github.com/users/launchdarkly/repos","events_url":"https://api.github.com/users/launchdarkly/events{/privacy}","received_events_url":"https://api.github.com/users/launchdarkly/received_events","type":"Organization","site_admin":false},"repo":{"id":22690924,"name":"python-client","full_name":"launchdarkly/python-client","owner":{"login":"launchdarkly","id":8039656,"avatar_url":"https://avatars.githubusercontent.com/u/8039656?v=3","gravatar_id":"","url":"https://api.github.com/users/launchdarkly","html_url":"https://github.com/launchdarkly","followers_url":"https://api.github.com/users/launchdarkly/followers","following_url":"https://api.github.com/users/launchdarkly/following{/other_user}","gists_url":"https://api.github.com/users/launchdarkly/gists{/gist_id}","starred_url":"https://api.github.com/users/launchdarkly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/launchdarkly/subscriptions","organizations_url":"https://api.github.com/users/launchdarkly/orgs","repos_url":"https://api.github.com/users/launchdarkly/repos","events_url":"https://api.github.com/users/launchdarkly/events{/privacy}","received_events_url":"https://api.github.com/users/launchdarkly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/launchdarkly/python-client","description":"LaunchDarkly SDK for Python","fork":false,"url":"https://api.github.com/repos/launchdarkly/python-client","forks_url":"https://api.github.com/repos/launchdarkly/python-client/forks","keys_url":"https://api.github.com/repos/launchdarkly/python-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/launchdarkly/python-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/launchdarkly/python-client/teams","hooks_url":"https://api.github.com/repos/launchdarkly/python-client/hooks","issue_events_url":"https://api.github.com/repos/launchdarkly/python-client/issues/events{/number}","events_url":"https://api.github.com/repos/launchdarkly/python-client/events","assignees_url":"https://api.github.com/repos/launchdarkly/python-client/assignees{/user}","branches_url":"https://api.github.com/repos/launchdarkly/python-client/branches{/branch}","tags_url":"https://api.github.com/repos/launchdarkly/python-client/tags","blobs_url":"https://api.github.com/repos/launchdarkly/python-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/launchdarkly/python-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/launchdarkly/python-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/launchdarkly/python-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/launchdarkly/python-client/statuses/{sha}","languages_url":"https://api.github.com/repos/launchdarkly/python-client/languages","stargazers_url":"https://api.github.com/repos/launchdarkly/python-client/stargazers","contributors_url":"https://api.github.com/repos/launchdarkly/python-client/contributors","subscribers_url":"https://api.github.com/repos/launchdarkly/python-client/subscribers","subscription_url":"https://api.github.com/repos/launchdarkly/python-client/subscription","commits_url":"https://api.github.com/repos/launchdarkly/python-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/launchdarkly/python-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/launchdarkly/python-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/launchdarkly/python-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/launchdarkly/python-client/contents/{+path}","compare_url":"https://api.github.com/repos/launchdarkly/python-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/launchdarkly/python-client/merges","archive_url":"https://api.github.com/repos/launchdarkly/python-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/launchdarkly/python-client/downloads","issues_url":"https://api.github.com/repos/launchdarkly/python-client/issues{/number}","pulls_url":"https://api.github.com/repos/launchdarkly/python-client/pulls{/number}","milestones_url":"https://api.github.com/repos/launchdarkly/python-client/milestones{/number}","notifications_url":"https://api.github.com/repos/launchdarkly/python-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/launchdarkly/python-client/labels{/name}","releases_url":"https://api.github.com/repos/launchdarkly/python-client/releases{/id}","created_at":"2014-08-06T17:02:49Z","updated_at":"2015-04-30T00:11:45Z","pushed_at":"2015-09-08T19:12:06Z","git_url":"git://github.com/launchdarkly/python-client.git","ssh_url":"git@github.com:launchdarkly/python-client.git","clone_url":"https://github.com/launchdarkly/python-client.git","svn_url":"https://github.com/launchdarkly/python-client","homepage":"http://www.launchdarkly.com","size":696,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"launchdarkly:master","ref":"master","sha":"bc37ab3811a03319ca31e3bc52f0a2342b1975bf","user":{"login":"launchdarkly","id":8039656,"avatar_url":"https://avatars.githubusercontent.com/u/8039656?v=3","gravatar_id":"","url":"https://api.github.com/users/launchdarkly","html_url":"https://github.com/launchdarkly","followers_url":"https://api.github.com/users/launchdarkly/followers","following_url":"https://api.github.com/users/launchdarkly/following{/other_user}","gists_url":"https://api.github.com/users/launchdarkly/gists{/gist_id}","starred_url":"https://api.github.com/users/launchdarkly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/launchdarkly/subscriptions","organizations_url":"https://api.github.com/users/launchdarkly/orgs","repos_url":"https://api.github.com/users/launchdarkly/repos","events_url":"https://api.github.com/users/launchdarkly/events{/privacy}","received_events_url":"https://api.github.com/users/launchdarkly/received_events","type":"Organization","site_admin":false},"repo":{"id":22690924,"name":"python-client","full_name":"launchdarkly/python-client","owner":{"login":"launchdarkly","id":8039656,"avatar_url":"https://avatars.githubusercontent.com/u/8039656?v=3","gravatar_id":"","url":"https://api.github.com/users/launchdarkly","html_url":"https://github.com/launchdarkly","followers_url":"https://api.github.com/users/launchdarkly/followers","following_url":"https://api.github.com/users/launchdarkly/following{/other_user}","gists_url":"https://api.github.com/users/launchdarkly/gists{/gist_id}","starred_url":"https://api.github.com/users/launchdarkly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/launchdarkly/subscriptions","organizations_url":"https://api.github.com/users/launchdarkly/orgs","repos_url":"https://api.github.com/users/launchdarkly/repos","events_url":"https://api.github.com/users/launchdarkly/events{/privacy}","received_events_url":"https://api.github.com/users/launchdarkly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/launchdarkly/python-client","description":"LaunchDarkly SDK for Python","fork":false,"url":"https://api.github.com/repos/launchdarkly/python-client","forks_url":"https://api.github.com/repos/launchdarkly/python-client/forks","keys_url":"https://api.github.com/repos/launchdarkly/python-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/launchdarkly/python-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/launchdarkly/python-client/teams","hooks_url":"https://api.github.com/repos/launchdarkly/python-client/hooks","issue_events_url":"https://api.github.com/repos/launchdarkly/python-client/issues/events{/number}","events_url":"https://api.github.com/repos/launchdarkly/python-client/events","assignees_url":"https://api.github.com/repos/launchdarkly/python-client/assignees{/user}","branches_url":"https://api.github.com/repos/launchdarkly/python-client/branches{/branch}","tags_url":"https://api.github.com/repos/launchdarkly/python-client/tags","blobs_url":"https://api.github.com/repos/launchdarkly/python-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/launchdarkly/python-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/launchdarkly/python-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/launchdarkly/python-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/launchdarkly/python-client/statuses/{sha}","languages_url":"https://api.github.com/repos/launchdarkly/python-client/languages","stargazers_url":"https://api.github.com/repos/launchdarkly/python-client/stargazers","contributors_url":"https://api.github.com/repos/launchdarkly/python-client/contributors","subscribers_url":"https://api.github.com/repos/launchdarkly/python-client/subscribers","subscription_url":"https://api.github.com/repos/launchdarkly/python-client/subscription","commits_url":"https://api.github.com/repos/launchdarkly/python-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/launchdarkly/python-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/launchdarkly/python-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/launchdarkly/python-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/launchdarkly/python-client/contents/{+path}","compare_url":"https://api.github.com/repos/launchdarkly/python-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/launchdarkly/python-client/merges","archive_url":"https://api.github.com/repos/launchdarkly/python-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/launchdarkly/python-client/downloads","issues_url":"https://api.github.com/repos/launchdarkly/python-client/issues{/number}","pulls_url":"https://api.github.com/repos/launchdarkly/python-client/pulls{/number}","milestones_url":"https://api.github.com/repos/launchdarkly/python-client/milestones{/number}","notifications_url":"https://api.github.com/repos/launchdarkly/python-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/launchdarkly/python-client/labels{/name}","releases_url":"https://api.github.com/repos/launchdarkly/python-client/releases{/id}","created_at":"2014-08-06T17:02:49Z","updated_at":"2015-04-30T00:11:45Z","pushed_at":"2015-09-08T19:12:06Z","git_url":"git://github.com/launchdarkly/python-client.git","ssh_url":"git@github.com:launchdarkly/python-client.git","clone_url":"https://github.com/launchdarkly/python-client.git","svn_url":"https://github.com/launchdarkly/python-client","homepage":"http://www.launchdarkly.com","size":696,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/launchdarkly/python-client/pulls/17"},"html":{"href":"https://github.com/launchdarkly/python-client/pull/17"},"issue":{"href":"https://api.github.com/repos/launchdarkly/python-client/issues/17"},"comments":{"href":"https://api.github.com/repos/launchdarkly/python-client/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/launchdarkly/python-client/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/launchdarkly/python-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/launchdarkly/python-client/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/launchdarkly/python-client/statuses/e5b00d8cbfefddd0775395da09c6c9b14e849ed6"}}}}