{"action":"created","issue":{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/1864","labels_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/1864/labels{/name}","comments_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/1864/comments","events_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/1864/events","html_url":"https://github.com/STEllAR-GROUP/hpx/issues/1864","id":116875548,"number":1864,"title":"run_guarded using bound function ignores reference","user":{"login":"Syntaf","id":1827631,"avatar_url":"https://avatars.githubusercontent.com/u/1827631?v=3","gravatar_id":"","url":"https://api.github.com/users/Syntaf","html_url":"https://github.com/Syntaf","followers_url":"https://api.github.com/users/Syntaf/followers","following_url":"https://api.github.com/users/Syntaf/following{/other_user}","gists_url":"https://api.github.com/users/Syntaf/gists{/gist_id}","starred_url":"https://api.github.com/users/Syntaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Syntaf/subscriptions","organizations_url":"https://api.github.com/users/Syntaf/orgs","repos_url":"https://api.github.com/users/Syntaf/repos","events_url":"https://api.github.com/users/Syntaf/events{/privacy}","received_events_url":"https://api.github.com/users/Syntaf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/labels/category:%20LCOs","name":"category: LCOs","color":"02e10c"},{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/labels/type:%20defect","name":"type: defect","color":"e10c02"}],"state":"open","locked":false,"assignee":{"login":"stevenrbrandt","id":1386187,"avatar_url":"https://avatars.githubusercontent.com/u/1386187?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenrbrandt","html_url":"https://github.com/stevenrbrandt","followers_url":"https://api.github.com/users/stevenrbrandt/followers","following_url":"https://api.github.com/users/stevenrbrandt/following{/other_user}","gists_url":"https://api.github.com/users/stevenrbrandt/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenrbrandt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenrbrandt/subscriptions","organizations_url":"https://api.github.com/users/stevenrbrandt/orgs","repos_url":"https://api.github.com/users/stevenrbrandt/repos","events_url":"https://api.github.com/users/stevenrbrandt/events{/privacy}","received_events_url":"https://api.github.com/users/stevenrbrandt/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/milestones/25","html_url":"https://github.com/STEllAR-GROUP/hpx/milestones/0.9.12","labels_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/milestones/25/labels","id":1380490,"number":25,"title":"0.9.12","description":"","creator":{"login":"hkaiser","id":568063,"avatar_url":"https://avatars.githubusercontent.com/u/568063?v=3","gravatar_id":"","url":"https://api.github.com/users/hkaiser","html_url":"https://github.com/hkaiser","followers_url":"https://api.github.com/users/hkaiser/followers","following_url":"https://api.github.com/users/hkaiser/following{/other_user}","gists_url":"https://api.github.com/users/hkaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/hkaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hkaiser/subscriptions","organizations_url":"https://api.github.com/users/hkaiser/orgs","repos_url":"https://api.github.com/users/hkaiser/repos","events_url":"https://api.github.com/users/hkaiser/events{/privacy}","received_events_url":"https://api.github.com/users/hkaiser/received_events","type":"User","site_admin":false},"open_issues":46,"closed_issues":5,"state":"open","created_at":"2015-10-27T22:19:24Z","updated_at":"2015-11-13T23:52:38Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-11-13T23:34:15Z","updated_at":"2015-11-13T23:54:16Z","closed_at":null,"body":"It seems binding a variable to a function, then calling run_guarded on that binding won't honor a reference. Take a minimal example\r\n\r\n```cpp\r\n#include <hpx/lcos/local/composable_guard.hpp>\r\n#include <hpx/util/bind.hpp>\r\n#include <hpx/hpx_init.hpp>\r\n#include <iostream>\r\n\r\nvoid incr(int &il1) {\r\n    // increment variable by 1, implicitly lock guard\r\n    il1 = il1 + 1;\r\n    // implicitly unlock guard\r\n}\r\n\r\nhpx::lcos::local::guard l1;\r\n\r\nint hpx_main(boost::program_options::variables_map&)\r\n{\r\n    int i1 = 0;\r\n\r\n    // run incr with i1 passed as a reference\r\n    run_guarded(l1, hpx::util::bind(incr, boost::ref(i1)));\r\n    \r\n    std::cout << i1 << std::endl;\r\n\r\n    return hpx::finalize();\r\n}\r\n\r\nint main(int argc, char* argv[]) \r\n{\r\n    boost::program_options::options_description\r\n        desc_commandline(\"Usage: \" HPX_APPLICATION_STRING \" [options]\");\r\n\r\n    return hpx::init(desc_commandline, argc, argv);\r\n}\r\n```\r\n\r\nIf you were to compile and run this\r\n\r\n```\r\n> ./a.out\r\n0\r\n```\r\n\r\nIt seem's `i1` is not updated, although i've bound a reference of it to incr and invoked it via run_guarded. Is this a bug or am I mistaken? "},"comment":{"url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/comments/156592986","html_url":"https://github.com/STEllAR-GROUP/hpx/issues/1864#issuecomment-156592986","issue_url":"https://api.github.com/repos/STEllAR-GROUP/hpx/issues/1864","id":156592986,"user":{"login":"Syntaf","id":1827631,"avatar_url":"https://avatars.githubusercontent.com/u/1827631?v=3","gravatar_id":"","url":"https://api.github.com/users/Syntaf","html_url":"https://github.com/Syntaf","followers_url":"https://api.github.com/users/Syntaf/followers","following_url":"https://api.github.com/users/Syntaf/following{/other_user}","gists_url":"https://api.github.com/users/Syntaf/gists{/gist_id}","starred_url":"https://api.github.com/users/Syntaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Syntaf/subscriptions","organizations_url":"https://api.github.com/users/Syntaf/orgs","repos_url":"https://api.github.com/users/Syntaf/repos","events_url":"https://api.github.com/users/Syntaf/events{/privacy}","received_events_url":"https://api.github.com/users/Syntaf/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T23:54:16Z","updated_at":"2015-11-13T23:54:16Z","body":"IRC Logs:\r\n```\r\n<K-ballo> Syntaf: does it ever hit incr?\r\n<Syntaf> K-ballo: inc is called, if I placed a print statement within it, it would print \r\n<K-ballo> the guard executes afterwars\r\n<K-ballo> *afterwards\r\n<K-ballo> weird, I too would have expected it to synchronize\r\n<K-ballo> not bind's fault then\r\n<Syntaf> so run_guarded has fire and forget semantics?\r\n<hkaiser> Syntaf: it seems to execute things during destruction\r\n```"}}