{"action":"created","comment":{"url":"https://api.github.com/repos/dmtcp/dmtcp/pulls/comments/29303859","id":29303859,"diff_hunk":"@@ -46,6 +43,9 @@ int jassert_quiet = 0;\n static int theLogFileFd = -1;\n static int errConsoleFd = -1;\n \n+static jalib::string& tmpDir() {static jalib::string s;return s;};\n+static jalib::string& uniquePidStr() {static jalib::string s;return s;};","path":"jalib/jassert.cpp","position":15,"original_position":15,"commit_id":"50d302ad912d0feda8de04e06c954f3f60e68055","original_commit_id":"50d302ad912d0feda8de04e06c954f3f60e68055","user":{"login":"rohgarg","id":1672104,"avatar_url":"https://avatars.githubusercontent.com/u/1672104?v=3","gravatar_id":"","url":"https://api.github.com/users/rohgarg","html_url":"https://github.com/rohgarg","followers_url":"https://api.github.com/users/rohgarg/followers","following_url":"https://api.github.com/users/rohgarg/following{/other_user}","gists_url":"https://api.github.com/users/rohgarg/gists{/gist_id}","starred_url":"https://api.github.com/users/rohgarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rohgarg/subscriptions","organizations_url":"https://api.github.com/users/rohgarg/orgs","repos_url":"https://api.github.com/users/rohgarg/repos","events_url":"https://api.github.com/users/rohgarg/events{/privacy}","received_events_url":"https://api.github.com/users/rohgarg/received_events","type":"User","site_admin":false},"body":"@gc00: Also, with multiple global (non-primitive) objects, the order in which their constructors are called is hard to reason about. It is not defined by the language specification. However, in this case, we want precise control over when the initialization of `tmpDir` happens. This is important because the DMTCP libraries, and the executables that statically link with `libjalib.a` can define their own global C++ objects. (In fact, libdmtcp relies on this trick to inject a ckpt thread in every process).\r\n\r\nAs @karya0 mentioned earlier, wrapping global C++ objects in functions is the idiomatic way of implementing this. This is portable and avoids non-deterministic behavior. See: https://isocpp.org/wiki/faq/ctors#static-init-order, and https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use.","created_at":"2015-04-29T01:06:19Z","updated_at":"2015-04-29T01:06:19Z","html_url":"https://github.com/dmtcp/dmtcp/pull/67#discussion_r29303859","pull_request_url":"https://api.github.com/repos/dmtcp/dmtcp/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/dmtcp/dmtcp/pulls/comments/29303859"},"html":{"href":"https://github.com/dmtcp/dmtcp/pull/67#discussion_r29303859"},"pull_request":{"href":"https://api.github.com/repos/dmtcp/dmtcp/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/dmtcp/dmtcp/pulls/67","id":34102041,"html_url":"https://github.com/dmtcp/dmtcp/pull/67","diff_url":"https://github.com/dmtcp/dmtcp/pull/67.diff","patch_url":"https://github.com/dmtcp/dmtcp/pull/67.patch","issue_url":"https://api.github.com/repos/dmtcp/dmtcp/issues/67","number":67,"state":"open","locked":false,"title":"Jalib cleanup","user":{"login":"karya0","id":433762,"avatar_url":"https://avatars.githubusercontent.com/u/433762?v=3","gravatar_id":"","url":"https://api.github.com/users/karya0","html_url":"https://github.com/karya0","followers_url":"https://api.github.com/users/karya0/followers","following_url":"https://api.github.com/users/karya0/following{/other_user}","gists_url":"https://api.github.com/users/karya0/gists{/gist_id}","starred_url":"https://api.github.com/users/karya0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karya0/subscriptions","organizations_url":"https://api.github.com/users/karya0/orgs","repos_url":"https://api.github.com/users/karya0/repos","events_url":"https://api.github.com/users/karya0/events{/privacy}","received_events_url":"https://api.github.com/users/karya0/received_events","type":"User","site_admin":false},"body":"This is an attempt to remove Jalib's dependency on dmtcp.h to get closer to the ideal world where jalib is oblivious to DMTCP.\r\n\r\nAddresses #63.","created_at":"2015-04-25T07:00:34Z","updated_at":"2015-04-29T01:06:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd8ee2604486c8209f3a6107846081a65d48adc2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dmtcp/dmtcp/pulls/67/commits","review_comments_url":"https://api.github.com/repos/dmtcp/dmtcp/pulls/67/comments","review_comment_url":"https://api.github.com/repos/dmtcp/dmtcp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmtcp/dmtcp/issues/67/comments","statuses_url":"https://api.github.com/repos/dmtcp/dmtcp/statuses/50d302ad912d0feda8de04e06c954f3f60e68055","head":{"label":"karya0:jalib-cleanup","ref":"jalib-cleanup","sha":"50d302ad912d0feda8de04e06c954f3f60e68055","user":{"login":"karya0","id":433762,"avatar_url":"https://avatars.githubusercontent.com/u/433762?v=3","gravatar_id":"","url":"https://api.github.com/users/karya0","html_url":"https://github.com/karya0","followers_url":"https://api.github.com/users/karya0/followers","following_url":"https://api.github.com/users/karya0/following{/other_user}","gists_url":"https://api.github.com/users/karya0/gists{/gist_id}","starred_url":"https://api.github.com/users/karya0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karya0/subscriptions","organizations_url":"https://api.github.com/users/karya0/orgs","repos_url":"https://api.github.com/users/karya0/repos","events_url":"https://api.github.com/users/karya0/events{/privacy}","received_events_url":"https://api.github.com/users/karya0/received_events","type":"User","site_admin":false},"repo":{"id":24396411,"name":"dmtcp","full_name":"karya0/dmtcp","owner":{"login":"karya0","id":433762,"avatar_url":"https://avatars.githubusercontent.com/u/433762?v=3","gravatar_id":"","url":"https://api.github.com/users/karya0","html_url":"https://github.com/karya0","followers_url":"https://api.github.com/users/karya0/followers","following_url":"https://api.github.com/users/karya0/following{/other_user}","gists_url":"https://api.github.com/users/karya0/gists{/gist_id}","starred_url":"https://api.github.com/users/karya0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karya0/subscriptions","organizations_url":"https://api.github.com/users/karya0/orgs","repos_url":"https://api.github.com/users/karya0/repos","events_url":"https://api.github.com/users/karya0/events{/privacy}","received_events_url":"https://api.github.com/users/karya0/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/karya0/dmtcp","description":"DMTCP: Distributed MultiThreaded CheckPointing","fork":true,"url":"https://api.github.com/repos/karya0/dmtcp","forks_url":"https://api.github.com/repos/karya0/dmtcp/forks","keys_url":"https://api.github.com/repos/karya0/dmtcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/karya0/dmtcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/karya0/dmtcp/teams","hooks_url":"https://api.github.com/repos/karya0/dmtcp/hooks","issue_events_url":"https://api.github.com/repos/karya0/dmtcp/issues/events{/number}","events_url":"https://api.github.com/repos/karya0/dmtcp/events","assignees_url":"https://api.github.com/repos/karya0/dmtcp/assignees{/user}","branches_url":"https://api.github.com/repos/karya0/dmtcp/branches{/branch}","tags_url":"https://api.github.com/repos/karya0/dmtcp/tags","blobs_url":"https://api.github.com/repos/karya0/dmtcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/karya0/dmtcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/karya0/dmtcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/karya0/dmtcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/karya0/dmtcp/statuses/{sha}","languages_url":"https://api.github.com/repos/karya0/dmtcp/languages","stargazers_url":"https://api.github.com/repos/karya0/dmtcp/stargazers","contributors_url":"https://api.github.com/repos/karya0/dmtcp/contributors","subscribers_url":"https://api.github.com/repos/karya0/dmtcp/subscribers","subscription_url":"https://api.github.com/repos/karya0/dmtcp/subscription","commits_url":"https://api.github.com/repos/karya0/dmtcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/karya0/dmtcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/karya0/dmtcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/karya0/dmtcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/karya0/dmtcp/contents/{+path}","compare_url":"https://api.github.com/repos/karya0/dmtcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/karya0/dmtcp/merges","archive_url":"https://api.github.com/repos/karya0/dmtcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/karya0/dmtcp/downloads","issues_url":"https://api.github.com/repos/karya0/dmtcp/issues{/number}","pulls_url":"https://api.github.com/repos/karya0/dmtcp/pulls{/number}","milestones_url":"https://api.github.com/repos/karya0/dmtcp/milestones{/number}","notifications_url":"https://api.github.com/repos/karya0/dmtcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/karya0/dmtcp/labels{/name}","releases_url":"https://api.github.com/repos/karya0/dmtcp/releases{/id}","created_at":"2014-09-24T01:37:01Z","updated_at":"2015-04-10T20:52:57Z","pushed_at":"2015-04-25T20:40:38Z","git_url":"git://github.com/karya0/dmtcp.git","ssh_url":"git@github.com:karya0/dmtcp.git","clone_url":"https://github.com/karya0/dmtcp.git","svn_url":"https://github.com/karya0/dmtcp","homepage":"http://dmtcp.sourceforge.net/","size":11250,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dmtcp:master","ref":"master","sha":"b2cff490284d1ea4a4bcaf7e2e04563bf7b14c81","user":{"login":"dmtcp","id":1207316,"avatar_url":"https://avatars.githubusercontent.com/u/1207316?v=3","gravatar_id":"","url":"https://api.github.com/users/dmtcp","html_url":"https://github.com/dmtcp","followers_url":"https://api.github.com/users/dmtcp/followers","following_url":"https://api.github.com/users/dmtcp/following{/other_user}","gists_url":"https://api.github.com/users/dmtcp/gists{/gist_id}","starred_url":"https://api.github.com/users/dmtcp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmtcp/subscriptions","organizations_url":"https://api.github.com/users/dmtcp/orgs","repos_url":"https://api.github.com/users/dmtcp/repos","events_url":"https://api.github.com/users/dmtcp/events{/privacy}","received_events_url":"https://api.github.com/users/dmtcp/received_events","type":"Organization","site_admin":false},"repo":{"id":24297650,"name":"dmtcp","full_name":"dmtcp/dmtcp","owner":{"login":"dmtcp","id":1207316,"avatar_url":"https://avatars.githubusercontent.com/u/1207316?v=3","gravatar_id":"","url":"https://api.github.com/users/dmtcp","html_url":"https://github.com/dmtcp","followers_url":"https://api.github.com/users/dmtcp/followers","following_url":"https://api.github.com/users/dmtcp/following{/other_user}","gists_url":"https://api.github.com/users/dmtcp/gists{/gist_id}","starred_url":"https://api.github.com/users/dmtcp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmtcp/subscriptions","organizations_url":"https://api.github.com/users/dmtcp/orgs","repos_url":"https://api.github.com/users/dmtcp/repos","events_url":"https://api.github.com/users/dmtcp/events{/privacy}","received_events_url":"https://api.github.com/users/dmtcp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dmtcp/dmtcp","description":"DMTCP: Distributed MultiThreaded CheckPointing","fork":false,"url":"https://api.github.com/repos/dmtcp/dmtcp","forks_url":"https://api.github.com/repos/dmtcp/dmtcp/forks","keys_url":"https://api.github.com/repos/dmtcp/dmtcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmtcp/dmtcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmtcp/dmtcp/teams","hooks_url":"https://api.github.com/repos/dmtcp/dmtcp/hooks","issue_events_url":"https://api.github.com/repos/dmtcp/dmtcp/issues/events{/number}","events_url":"https://api.github.com/repos/dmtcp/dmtcp/events","assignees_url":"https://api.github.com/repos/dmtcp/dmtcp/assignees{/user}","branches_url":"https://api.github.com/repos/dmtcp/dmtcp/branches{/branch}","tags_url":"https://api.github.com/repos/dmtcp/dmtcp/tags","blobs_url":"https://api.github.com/repos/dmtcp/dmtcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmtcp/dmtcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmtcp/dmtcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmtcp/dmtcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmtcp/dmtcp/statuses/{sha}","languages_url":"https://api.github.com/repos/dmtcp/dmtcp/languages","stargazers_url":"https://api.github.com/repos/dmtcp/dmtcp/stargazers","contributors_url":"https://api.github.com/repos/dmtcp/dmtcp/contributors","subscribers_url":"https://api.github.com/repos/dmtcp/dmtcp/subscribers","subscription_url":"https://api.github.com/repos/dmtcp/dmtcp/subscription","commits_url":"https://api.github.com/repos/dmtcp/dmtcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmtcp/dmtcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmtcp/dmtcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmtcp/dmtcp/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmtcp/dmtcp/contents/{+path}","compare_url":"https://api.github.com/repos/dmtcp/dmtcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmtcp/dmtcp/merges","archive_url":"https://api.github.com/repos/dmtcp/dmtcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmtcp/dmtcp/downloads","issues_url":"https://api.github.com/repos/dmtcp/dmtcp/issues{/number}","pulls_url":"https://api.github.com/repos/dmtcp/dmtcp/pulls{/number}","milestones_url":"https://api.github.com/repos/dmtcp/dmtcp/milestones{/number}","notifications_url":"https://api.github.com/repos/dmtcp/dmtcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmtcp/dmtcp/labels{/name}","releases_url":"https://api.github.com/repos/dmtcp/dmtcp/releases{/id}","created_at":"2014-09-21T17:21:59Z","updated_at":"2015-04-27T13:26:18Z","pushed_at":"2015-04-28T23:39:15Z","git_url":"git://github.com/dmtcp/dmtcp.git","ssh_url":"git@github.com:dmtcp/dmtcp.git","clone_url":"https://github.com/dmtcp/dmtcp.git","svn_url":"https://github.com/dmtcp/dmtcp","homepage":"http://dmtcp.sourceforge.net/","size":15830,"stargazers_count":15,"watchers_count":15,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"open_issues_count":38,"forks":9,"open_issues":38,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmtcp/dmtcp/pulls/67"},"html":{"href":"https://github.com/dmtcp/dmtcp/pull/67"},"issue":{"href":"https://api.github.com/repos/dmtcp/dmtcp/issues/67"},"comments":{"href":"https://api.github.com/repos/dmtcp/dmtcp/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/dmtcp/dmtcp/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/dmtcp/dmtcp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmtcp/dmtcp/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/dmtcp/dmtcp/statuses/50d302ad912d0feda8de04e06c954f3f60e68055"}}}}