wip: work on scheduler, async, coroutines, and merge scope into context
This commit is contained in:
1 parent
1e6e5e611b
commit
b56ea6c9a9
11 files changed
+420
-442
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ pub static App: FC<()> = |(cx, _)| {
|
||||
|
||||
let (async_count, dir) = (count.for_async(), *direction);
|
||||
|
||||
let (task, _) = use_task(cx, move || async move {
|
||||
let (task, _) = use_coroutine(cx, move || async move {
|
||||
loop {
|
||||
TimeoutFuture::new(250).await;
|
||||
*async_count.get_mut() += dir;
|
||||
|
||||
@@ -32,13 +32,13 @@ static App: FC<()> = |(cx, props)| {
|
||||
let p2 = use_state(cx, || 0);
|
||||
|
||||
let (mut p1_async, mut p2_async) = (p1.for_async(), p2.for_async());
|
||||
let (p1_handle, _) = use_task(cx, || async move {
|
||||
let (p1_handle, _) = use_coroutine(cx, || async move {
|
||||
loop {
|
||||
*p1_async.get_mut() += 1;
|
||||
async_std::task::sleep(std::time::Duration::from_millis(75)).await;
|
||||
}
|
||||
});
|
||||
let (p2_handle, _) = use_task(cx, || async move {
|
||||
let (p2_handle, _) = use_coroutine(cx, || async move {
|
||||
loop {
|
||||
*p2_async.get_mut() += 1;
|
||||
async_std::task::sleep(std::time::Duration::from_millis(100)).await;
|
||||
|
||||
Reference in new issue
Block a user