{"action":"opened","issue":{"url":"https://api.github.com/repos/spark/firmware/issues/659","labels_url":"https://api.github.com/repos/spark/firmware/issues/659/labels{/name}","comments_url":"https://api.github.com/repos/spark/firmware/issues/659/comments","events_url":"https://api.github.com/repos/spark/firmware/issues/659/events","html_url":"https://github.com/spark/firmware/issues/659","id":109588070,"number":659,"title":"Multithreading: Second life for Particle.process()","user":{"login":"ScruffR","id":6604878,"avatar_url":"https://avatars.githubusercontent.com/u/6604878?v=3","gravatar_id":"","url":"https://api.github.com/users/ScruffR","html_url":"https://github.com/ScruffR","followers_url":"https://api.github.com/users/ScruffR/followers","following_url":"https://api.github.com/users/ScruffR/following{/other_user}","gists_url":"https://api.github.com/users/ScruffR/gists{/gist_id}","starred_url":"https://api.github.com/users/ScruffR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScruffR/subscriptions","organizations_url":"https://api.github.com/users/ScruffR/orgs","repos_url":"https://api.github.com/users/ScruffR/repos","events_url":"https://api.github.com/users/ScruffR/events{/privacy}","received_events_url":"https://api.github.com/users/ScruffR/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-02T23:13:44Z","updated_at":"2015-10-02T23:13:44Z","closed_at":null,"body":"As per this discussion https://s.slack.com/archives/elite/p1443824246000119\r\n\r\nMultithreading might lead people (like myself ;-) ) to the thought that we no longer need to exit `loop()` since all the cloud stuff is done in a seperate thread. \r\nBut this is not the case for `Particle.function()` code and `Particle.subscribe()` handlers since they are considered application code and not system code. \r\nAnd even calling `Particle.process()` doesn't help this (as it would have in `SYSTEM_MODE(MANUAL)`) since it (aparently) got degraded to a mere stub, not doing anything.\r\n\r\nSo I'd see two options to save confusion\r\nEither (as also proposed by Doc) let `Particle.process()` live on to do the function/subscription handling\r\nor (my preference)\r\nhave the function/subsription handlers become callback functions that can be directly hooked up to the system thread - this might require some measures for thread/context safety on the coders side, but should be doable (e.g. as a C# guy [`InvokeRequired`](https://msdn.microsoft.com/en-us/library/ms171728(v=vs.110).aspx) strategies) "}}