{"action":"created","issue":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/846","labels_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/846/labels{/name}","comments_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/846/comments","events_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/846/events","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/846","id":121889250,"number":846,"title":"Some modules incompatable with Lua coroutining","user":{"login":"TerryE","id":690173,"avatar_url":"https://avatars.githubusercontent.com/u/690173?v=3","gravatar_id":"","url":"https://api.github.com/users/TerryE","html_url":"https://github.com/TerryE","followers_url":"https://api.github.com/users/TerryE/followers","following_url":"https://api.github.com/users/TerryE/following{/other_user}","gists_url":"https://api.github.com/users/TerryE/gists{/gist_id}","starred_url":"https://api.github.com/users/TerryE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TerryE/subscriptions","organizations_url":"https://api.github.com/users/TerryE/orgs","repos_url":"https://api.github.com/users/TerryE/repos","events_url":"https://api.github.com/users/TerryE/events{/privacy}","received_events_url":"https://api.github.com/users/TerryE/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"TerryE","id":690173,"avatar_url":"https://avatars.githubusercontent.com/u/690173?v=3","gravatar_id":"","url":"https://api.github.com/users/TerryE","html_url":"https://github.com/TerryE","followers_url":"https://api.github.com/users/TerryE/followers","following_url":"https://api.github.com/users/TerryE/following{/other_user}","gists_url":"https://api.github.com/users/TerryE/gists{/gist_id}","starred_url":"https://api.github.com/users/TerryE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TerryE/subscriptions","organizations_url":"https://api.github.com/users/TerryE/orgs","repos_url":"https://api.github.com/users/TerryE/repos","events_url":"https://api.github.com/users/TerryE/events{/privacy}","received_events_url":"https://api.github.com/users/TerryE/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-12-13T00:30:53Z","updated_at":"2015-12-15T06:34:30Z","closed_at":null,"body":"I've just been making some blanket changes to the modules and noticed that CJSON assumes a single global state in \r\n\r\n```C\r\nstatic lua_State *gL;\r\n// ... \r\nvoid cjson_mem_setlua (lua_State *L)\r\n{\r\n  gL = L;\r\n}\r\n\r\nvoid *cjson_mem_malloc (uint32_t sz)\r\n{\r\n  void *p = (void*)c_malloc (sz);\r\n  if (!p && gL)\r\n// ...\r\n```\r\nSeparate coroutine threads have separate state vectors L.  This code assumes that there is a single global state vector.  Not good. "},"comment":{"url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/comments/164659690","html_url":"https://github.com/nodemcu/nodemcu-firmware/issues/846#issuecomment-164659690","issue_url":"https://api.github.com/repos/nodemcu/nodemcu-firmware/issues/846","id":164659690,"user":{"login":"jmattsson","id":869607,"avatar_url":"https://avatars.githubusercontent.com/u/869607?v=3","gravatar_id":"","url":"https://api.github.com/users/jmattsson","html_url":"https://github.com/jmattsson","followers_url":"https://api.github.com/users/jmattsson/followers","following_url":"https://api.github.com/users/jmattsson/following{/other_user}","gists_url":"https://api.github.com/users/jmattsson/gists{/gist_id}","starred_url":"https://api.github.com/users/jmattsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmattsson/subscriptions","organizations_url":"https://api.github.com/users/jmattsson/orgs","repos_url":"https://api.github.com/users/jmattsson/repos","events_url":"https://api.github.com/users/jmattsson/events{/privacy}","received_events_url":"https://api.github.com/users/jmattsson/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T06:34:30Z","updated_at":"2015-12-15T06:34:30Z","body":"What about upvalues inside callbacks registered from co-routines? Would that still be bound/available correctly?"}}