{"action":"created","issue":{"url":"https://api.github.com/repos/puniverse/quasar/issues/99","labels_url":"https://api.github.com/repos/puniverse/quasar/issues/99/labels{/name}","comments_url":"https://api.github.com/repos/puniverse/quasar/issues/99/comments","events_url":"https://api.github.com/repos/puniverse/quasar/issues/99/events","html_url":"https://github.com/puniverse/quasar/issues/99","id":92318341,"number":99,"title":"is scheduling Fibers by myself possible ?","user":{"login":"ltearno","id":191069,"avatar_url":"https://avatars.githubusercontent.com/u/191069?v=3","gravatar_id":"","url":"https://api.github.com/users/ltearno","html_url":"https://github.com/ltearno","followers_url":"https://api.github.com/users/ltearno/followers","following_url":"https://api.github.com/users/ltearno/following{/other_user}","gists_url":"https://api.github.com/users/ltearno/gists{/gist_id}","starred_url":"https://api.github.com/users/ltearno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ltearno/subscriptions","organizations_url":"https://api.github.com/users/ltearno/orgs","repos_url":"https://api.github.com/users/ltearno/repos","events_url":"https://api.github.com/users/ltearno/events{/privacy}","received_events_url":"https://api.github.com/users/ltearno/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-01T08:47:10Z","updated_at":"2015-07-01T12:18:41Z","closed_at":null,"body":"Hello, i need to schedule a fiber by myself, in the way that this is done in the original Matthiass Mann library.\r\n\r\nSo the code would look like :\r\n\r\n\tMyScheduler scheduler = new MyScheduler(...);\r\n\tFiber<Void> fiber = new Fiber(scheduler);\r\n\tfiber.start();\r\n\r\n\twhile( scheduler.hasSomethingToDo() )\r\n\t{\r\n\t\t// executes the scheduled fiber on the current thread\r\n\t\t// if the fiber's code calls 'park' then the scheduler.step() returns\r\n\t\tscheduler.step();\r\n\t\t\r\n\t\t// prepare next things to do...\r\n\t\t// this will eventually unpark some of the previously parked fibers\r\n\t}\r\n\r\nIs that possible do you think by implementing a new FiberScheduler ?\r\n\r\nNote : the thread on which i will execute the fibers \r\n\r\nThanks for your anwser\r\nAnd thanks for this great library, I love Quasar !!!\r\n\r\nArnaud Tournier"},"comment":{"url":"https://api.github.com/repos/puniverse/quasar/issues/comments/117638202","html_url":"https://github.com/puniverse/quasar/issues/99#issuecomment-117638202","issue_url":"https://api.github.com/repos/puniverse/quasar/issues/99","id":117638202,"user":{"login":"ltearno","id":191069,"avatar_url":"https://avatars.githubusercontent.com/u/191069?v=3","gravatar_id":"","url":"https://api.github.com/users/ltearno","html_url":"https://github.com/ltearno","followers_url":"https://api.github.com/users/ltearno/followers","following_url":"https://api.github.com/users/ltearno/following{/other_user}","gists_url":"https://api.github.com/users/ltearno/gists{/gist_id}","starred_url":"https://api.github.com/users/ltearno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ltearno/subscriptions","organizations_url":"https://api.github.com/users/ltearno/orgs","repos_url":"https://api.github.com/users/ltearno/repos","events_url":"https://api.github.com/users/ltearno/events{/privacy}","received_events_url":"https://api.github.com/users/ltearno/received_events","type":"User","site_admin":false},"created_at":"2015-07-01T12:18:41Z","updated_at":"2015-07-01T12:18:41Z","body":"Thanks for your answer.\n\nBut as far as i understand, in your example, the fiber is not executed in\nthe caller's thread, but instead it is running in the FiberTimedScheduler's\nworking thread. And the call to fiber.unpark() will spin until the called\nfiber is really unparked - so that's not the behavior i wanted to run.\n\nAm i right ?\n\nThat's a good news that you will (maybe) expose the continuations directly\n! I am totally for it (as a freelance i might be available to implement\nthat if you want ;) ).\nI must say that the improvments you added to the Matthias Mann library is\nvery cool to me (especially the ant task detecting all the methods needed\nto be instrumented, and the @Suspendable annotation is really cool too). At\nthe current time, combining Quasar and the original library poses a bit of\nproblem but i think that's normal (methods instrumented by Matthias Mann\ndont get instrumented by Quasar it seems to me).\n\nThanks a lot\n\nArnaud\n\nLe mer. 1 juil. 2015 à 11:36, pron <notifications@github.com> a écrit :\n\n> It is possible (though I haven't tried), but you really shouldn't do it.\n> It's not our intent to expose continuations directly (we may in the future,\n> though).\n>\n> However, if you still want to try, try this:\n>\n> FiberScheduler myScheduler = new FiberExecutorScheduler(\"cont\", r -> r.run());\n>\n> This would create a scheduler that would schedule tasks to run in-place on\n> the calling thread. Then:\n>\n> Fiber<Void> fiber = new Fiber(myScheduler, () -> { ... });\n> fiber.start();while(!fiber.isDone()) {\n>     fiber.unpark();\n> }\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/puniverse/quasar/issues/99#issuecomment-117562911>.\n>\n"}}