{"action":"created","issue":{"url":"https://api.github.com/repos/zonyitoo/context-rs/issues/18","labels_url":"https://api.github.com/repos/zonyitoo/context-rs/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/zonyitoo/context-rs/issues/18/comments","events_url":"https://api.github.com/repos/zonyitoo/context-rs/issues/18/events","html_url":"https://github.com/zonyitoo/context-rs/pull/18","id":114427776,"number":18,"title":"Rewrite NOT FOR MERGE","user":{"login":"target-san","id":4011726,"avatar_url":"https://avatars.githubusercontent.com/u/4011726?v=3","gravatar_id":"","url":"https://api.github.com/users/target-san","html_url":"https://github.com/target-san","followers_url":"https://api.github.com/users/target-san/followers","following_url":"https://api.github.com/users/target-san/following{/other_user}","gists_url":"https://api.github.com/users/target-san/gists{/gist_id}","starred_url":"https://api.github.com/users/target-san/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/target-san/subscriptions","organizations_url":"https://api.github.com/users/target-san/orgs","repos_url":"https://api.github.com/users/target-san/repos","events_url":"https://api.github.com/users/target-san/events{/privacy}","received_events_url":"https://api.github.com/users/target-san/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-31T18:52:27Z","updated_at":"2015-11-01T12:01:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zonyitoo/context-rs/pulls/18","html_url":"https://github.com/zonyitoo/context-rs/pull/18","diff_url":"https://github.com/zonyitoo/context-rs/pull/18.diff","patch_url":"https://github.com/zonyitoo/context-rs/pull/18.patch"},"body":"Please review these changes and share your opinion.\r\nIt's not for merge because it lacks testing, and some features (like stack pool) must be brought back.\r\nBut you can observe general design, and more important, how coroutines would look like. And no FnBox :)\r\n\r\nOh yes, one more important detail. I reused Boost's approach with context stored on stack directly. That's because I consider `save` operation to be not only unsafe, but just dangerous. You can easily jump into state which is not consistent anymore."},"comment":{"url":"https://api.github.com/repos/zonyitoo/context-rs/issues/comments/152821804","html_url":"https://github.com/zonyitoo/context-rs/pull/18#issuecomment-152821804","issue_url":"https://api.github.com/repos/zonyitoo/context-rs/issues/18","id":152821804,"user":{"login":"target-san","id":4011726,"avatar_url":"https://avatars.githubusercontent.com/u/4011726?v=3","gravatar_id":"","url":"https://api.github.com/users/target-san","html_url":"https://github.com/target-san","followers_url":"https://api.github.com/users/target-san/followers","following_url":"https://api.github.com/users/target-san/following{/other_user}","gists_url":"https://api.github.com/users/target-san/gists{/gist_id}","starred_url":"https://api.github.com/users/target-san/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/target-san/subscriptions","organizations_url":"https://api.github.com/users/target-san/orgs","repos_url":"https://api.github.com/users/target-san/repos","events_url":"https://api.github.com/users/target-san/events{/privacy}","received_events_url":"https://api.github.com/users/target-san/received_events","type":"User","site_admin":false},"created_at":"2015-11-01T12:01:26Z","updated_at":"2015-11-01T12:01:26Z","body":"As I said, just storing current context isn't a very good idea IMO. I wrote an example in coroutine discussion thread. To be short, by storing current context you effectively allow jumping into it from the same thread. But the state you stored will almost certainly be invalid. And then it will kaboom.\r\n\r\nAnd yes, the main idea is that you'll need separate stack for each coroutine. Because that stack is part of its state, and can't be treated as separate entity as long as coroutine lives. Though, you can create coroutine based on on-stack buffer. The downside is, you won't be able to jump out of it. And there will be no overflow protection. That's what I'm using in tests.\r\n"}}